For a notification project, would like to push event notifications out. These are things like login, change in profile, etc., and to be displayed to the appropriate client. I would like to discuss some ideas on putting it together, and get some advice on the best approach.
对于通知项目,想要推送事件通知。这些是登录,更改个人资料等内容,并显示给相应的客户端。我想讨论将它们组合在一起的一些想法,并就最佳方法提出一些建议。
I noticed here that changes made to a CouchDB can be detected with a _changes stream, picked up by Node, and a process kicks off. I would like to implement something like this (I'm using SQL Server, but an entry point at this level may not be the best solution).
我在这里注意到,可以使用_changes流检测对CouchDB所做的更改,由Node拾取,然后流程开始。我想实现这样的东西(我使用的是SQL Server,但这个级别的入口点可能不是最好的解决方案)。
Instead of following the CouchDB example (detecting database-based events, I think this just complicates things, since we're interested in client events), I was thinking that when an event occurs, such as a user login, then a message is sent to the Node server with some event details (RESTful request?). This message is then processed and broadcast to all connected clients; the appropriate client displays notification.
而不是遵循CouchDB示例(检测基于数据库的事件,我认为这只会使事情变得复杂,因为我们对客户端事件感兴趣),我认为当事件发生时,例如用户登录,然后发送消息带有一些事件详细信息的节点服务器(RESTful请求?)。然后处理该消息并将其广播到所有连接的客户端;相应的客户端显示通知。
Proposed ecosystem:
拟议的生态系统:
- .Net 4.0
- .Net 4.0
- IIS
- IIS
- IISNode
- IISNode
- Socket.IO
- Socket.IO
- Node.JS
- Node.js的
- SQL Server 2008
- SQL Server 2008
This will be built on top of an existing project using the .Net framework (IIS, etc.). Many of the clients' browsers do not support web sockets, so using Socket.IO is a good option (fallback support). However, from what I can see, Socket.IO only still only supports long polling through IISNode (which isn't really a problem).
这将建立在使用.Net框架(IIS等)的现有项目之上。许多客户端的浏览器不支持Web套接字,因此使用Socket.IO是一个不错的选择(后备支持)。但是,从我所看到的,Socket.IO仍然只支持通过IISNode进行长轮询(这不是一个真正的问题)。
An option would be to expose the Socket.IO/Node endpoint to all clients, so that client-based notifications can be sent through JS to the Node server, which broadcasts the message. (follows the basic chat-server /client/server examples).
一个选项是将Socket.IO/Node端点暴露给所有客户端,以便基于客户端的通知可以通过JS发送到节点服务器,节点服务器广播消息。 (遵循基本的聊天服务器/客户端/服务器示例)。
Alternately, an IIS endpoint could be used, but could only support long polling (through Socket.IO). This would offer some additional .Net back-end processing, but may be over-complicating the architecture.
或者,可以使用IIS端点,但只能支持长轮询(通过Socket.IO)。这将提供一些额外的.Net后端处理,但可能使架构过于复杂。
Is there SQL Server-based event notification available for Node?
Node是否可以使用基于SQL Server的事件通知?
What would be the best approach?
什么是最好的方法?
If I didn't get the terminology ecosystem configuration right, please clarify.
如果我没有正确的术语生态系统配置,请澄清。
Thanks.
谢谢。
2 个解决方案
#1
13
I would recommend you check out SignalR first before considering adding iisnode/node.js to the mix of technologies of your pre-existing ASP.NET application.
在考虑将iisnode / node.js添加到预先存在的ASP.NET应用程序的混合技术之前,我建议您首先查看SignalR。
Regarding websockets, regardless if you use ASP.NET or node.js (socket.io), you can only use HTTP long polling for low latency notifications, as websockets are not supported by HTTP.SYS/IIS until Windows 8. iisnode does not currently support websockets (even on Windows 8), but such support could be added later.
关于websockets,无论你使用ASP.NET还是node.js(socket.io),你都只能使用HTTP长轮询来进行低延迟通知,因为HTTP.SYS / IIS不支持websockets直到Windows 8. iisnode没有目前支持websockets(即使在Windows 8上),但可以在以后添加这样的支持。
I did some research lately regarding MSSQL access from node.js. There are a few OSS projects out there, some of them use native, platform-specific extensions, some attempt implementing TDS protocol purely in JavaScript. I am not aware of any that would enable you to access the SQL Notifications functionality. However, the MSSQL team itself is investing in a first class MSSQL driver for node.js, so this is something to keep an eye on going forward (https://github.com/tjanczuk/iisnode/issues/139).
我最近做了一些关于从node.js访问MSSQL的研究。有一些OSS项目,其中一些使用本机的,特定于平台的扩展,一些尝试纯粹在JavaScript中实现TDS协议。我不知道任何可以使您访问SQL Notifications功能的内容。但是,MSSQL团队本身正在为node.js投资一流的MSSQL驱动程序,所以这是一个值得关注的事情(https://github.com/tjanczuk/iisnode/issues/139)。
If you plan to use SQL Notifications to support low latency notifications, I would strongly recommend starting with performance benchmarks that simulate the desired level of traffic at the SQL server level. SQL Notifications were meant primarily as a mechanism to help maintain in memory cache consistent with the content of the database, so it may or may not meet the requirements of your notification scenario. At the very minimum these measurements would help you start with a better design.
如果您计划使用SQL Notifications支持低延迟通知,我强烈建议您从性能基准开始,模拟SQL服务器级别的所需流量级别。 SQL Notifications主要用作帮助维护内存缓存的机制,与数据库的内容一致,因此它可能满足或不满足通知方案的要求。这些测量至少可以帮助您从更好的设计开始。
#2
2
I would highly recommend using Pusher. That is what we use and it makes it easy to implement as it is a hosted solution. So plugging it and making it work is really easy. It doesn't cost much unless you are going to push a crazy amount of messages through it on a massive scale.
我强烈推荐使用Pusher。这就是我们使用的东西,因为它是托管解决方案,因此很容易实现。因此插入它并使其工作非常容易。它不会花费太多,除非你要通过它大规模推送大量的消息。
#1
13
I would recommend you check out SignalR first before considering adding iisnode/node.js to the mix of technologies of your pre-existing ASP.NET application.
在考虑将iisnode / node.js添加到预先存在的ASP.NET应用程序的混合技术之前,我建议您首先查看SignalR。
Regarding websockets, regardless if you use ASP.NET or node.js (socket.io), you can only use HTTP long polling for low latency notifications, as websockets are not supported by HTTP.SYS/IIS until Windows 8. iisnode does not currently support websockets (even on Windows 8), but such support could be added later.
关于websockets,无论你使用ASP.NET还是node.js(socket.io),你都只能使用HTTP长轮询来进行低延迟通知,因为HTTP.SYS / IIS不支持websockets直到Windows 8. iisnode没有目前支持websockets(即使在Windows 8上),但可以在以后添加这样的支持。
I did some research lately regarding MSSQL access from node.js. There are a few OSS projects out there, some of them use native, platform-specific extensions, some attempt implementing TDS protocol purely in JavaScript. I am not aware of any that would enable you to access the SQL Notifications functionality. However, the MSSQL team itself is investing in a first class MSSQL driver for node.js, so this is something to keep an eye on going forward (https://github.com/tjanczuk/iisnode/issues/139).
我最近做了一些关于从node.js访问MSSQL的研究。有一些OSS项目,其中一些使用本机的,特定于平台的扩展,一些尝试纯粹在JavaScript中实现TDS协议。我不知道任何可以使您访问SQL Notifications功能的内容。但是,MSSQL团队本身正在为node.js投资一流的MSSQL驱动程序,所以这是一个值得关注的事情(https://github.com/tjanczuk/iisnode/issues/139)。
If you plan to use SQL Notifications to support low latency notifications, I would strongly recommend starting with performance benchmarks that simulate the desired level of traffic at the SQL server level. SQL Notifications were meant primarily as a mechanism to help maintain in memory cache consistent with the content of the database, so it may or may not meet the requirements of your notification scenario. At the very minimum these measurements would help you start with a better design.
如果您计划使用SQL Notifications支持低延迟通知,我强烈建议您从性能基准开始,模拟SQL服务器级别的所需流量级别。 SQL Notifications主要用作帮助维护内存缓存的机制,与数据库的内容一致,因此它可能满足或不满足通知方案的要求。这些测量至少可以帮助您从更好的设计开始。
#2
2
I would highly recommend using Pusher. That is what we use and it makes it easy to implement as it is a hosted solution. So plugging it and making it work is really easy. It doesn't cost much unless you are going to push a crazy amount of messages through it on a massive scale.
我强烈推荐使用Pusher。这就是我们使用的东西,因为它是托管解决方案,因此很容易实现。因此插入它并使其工作非常容易。它不会花费太多,除非你要通过它大规模推送大量的消息。