带有IIS节点的nodejs socket.io [英] nodejs socket.io with IIS Node
问题描述
我已经尝试使用iis节点在Windows Vista/IIS 7中使用node.js进行一些操作.我的想法是在asp .net mvc应用程序上使用服务器脚本来连接到另一个套接字服务器,并以持久的方式处理请求.
I have tried something with node.js in windows vista/IIS 7 using iis node. My idea is to use a server script on the asp .net mvc application to connect to another socket server and serve requests on a persistent fashion.
我从IIS 7的 https://github.com/tjanczuk/iisnode 下载了iisnode版本.并能够使用web.config和IIS模块配置中的http处理程序映射来运行基本的"hello world" http服务器管道.
I downloaded the iisnode version at https://github.com/tjanczuk/iisnode for IIS 7 and able to run the basic 'hello world' http server pipe using http handler mappings in web.config and IIS modules configuration.
我正在尝试使用来自node.js的socket.io库.如果我编写服务器和客户端,这将独立工作.但是与IIS节点一起使用时失败.
I am trying to use socket.io library from node.js. This works independently if I write a server and client. But fails when used with IIS node.
我遇到了进一步下降的问题.诸如此类的问题
I am having problems going down further. Problems like
- 如何在asp .net mvc项目中包括npm模块?我试过了 将node_modules放在节点脚本的文件夹中,但是 没有帮助.基本上,require('socket.io')命令有效,但是 套接字连接等,简直就是失败.
- 如何使用插座 来自客户端的连接,它将继续监听来自 服务器(如COMET)-正如我所说的,我正在尝试使用socket.io
- How to include the npm modules in the asp .net mvc project? I tried putting the node_modules in the folder of node scripts, but that did not help. Basically the require('socket.io') command works, but the socket connection etc., simply fails.
- How to have a socket connection from client which will keep listening for updates from server(like COMET) - As I said I am trying to use socket.io
有人尝试过吗?
推荐答案
回读几个月之前,IIS下的Socket.IO不支持WebSocket支持,但是需要长时间轮询.
Reading back a few months ago, WebSocket support is not supported with Socket.IO under IIS, however long polling is.
这是几个月前的事,我现在正面临着同样的问题,并试图解决.
This was a few months ago, and I'm running up against the same issue now and trying to resolve.
正如托马斯(Tomasz)所写:
As Tomasz writes:
请注意,iisnode不支持websocket传输,但是 在其他基于HTTP的传输中仍然可以使用socket.io 像HTTP长轮询一样:
Please note that iisnode does not support websocket transport, but using socket.io is still possible with other HTTP-based transports like HTTP long polling:
io.configure(function() {
io.set('transports', ['xhr-polling']);
});
通过它的外观,自2012年2月23日起,仍不支持此功能.
By the looks of it, as of Feb 23, 2012, this functionality is still not supported.
您需要通过IIS吗?您是否可以选择使用纯Socket.IO/Node选项,而无需使用IISNode?如果您需要具有回退功能的WebSocket全面支持,除非有其他建议,否则这似乎是唯一的选择?
Do you need to go through IIS? Do you have the option of going with a pure Socket.IO/Node option, eliminating IISNode? If you need full WebSocket support with fallback capability, this looks like the only option, unless there are other suggestions?
这篇关于带有IIS节点的nodejs socket.io的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!