我希望通过云服务将我的WinJS应用程序连接到移动浏览器客户端,每个人都使用网络套接字连接。
我使用socket.io构建了一个解决方案,只要我的node.js服务器托管在localhost上就可以正常运行:)当我将服务器部署到Azure时,Windows 8应用程序返回一个错误,说它无法加载外部内容。本地上下文(在调用socket.io的connect()之后)。
查看MSDN上的Web套接字示例,我认为我应该使用Windows.Networking.Sockets中的内置功能,至少在我的应用程序和公共云服务之间的内容,因为它不会尝试加载外部资源。
我的问题是:隧道另一端有哪些选择? 是否需要带有IIS 8的.NET 4.5主机(因为IIS 7不支持WS)? 我认为今天还没有,所以我想知道这里的发展故事是什么。
根据我最终用于服务器的内容,我想我必须再次使用socket.io或SignalR来为客户端服务(大多数不支持Web套接字,我需要一个良好的跨浏览器库:))
I'm looking to connect my WinJS app to mobile browser clients via a cloud service that everyone connects to using web sockets.
I built a solution using socket.io that works well as long as my node.js server is hosted on localhost :) When I deploy my server to Azure, the Windows 8 app returns an error saying it can't load external content in a local context (after calling socket.io's connect()).
Looking at the web sockets sample on MSDN, I think that I should use the built-in functionality in Windows.Networking.Sockets for at least what's between my app and the public cloud service as it won't try to load external resources.
My question is: what are the options for the other end of the tunnel? Does it require a .NET 4.5 host with IIS 8 (since IIS 7 doesn't support WS)? I don't think those exist today yet, so I'm wondering what the development story is here.
Depending on what I end up using for the server, I think I'll have to use socket.io again or SignalR to serve the clients (most won't support web sockets and I need a good cross-browser library :))
最满意答案
如果您的后端是NodeJS应用程序,则不需要 IIS服务器或与.NET Framework相关的任何内容。
NodeJS的作者在https://github.com/joyent/node/wiki/Node-Hosting上维护了托管服务提供商列表(该列表可能已过时,因为我在那里看不到Azure)。
我不明白为什么您的服务器在部署到Azure时不应该工作。 你在使用npm install azure吗?
我觉得你对Web套接字和Socket.io感到困惑。
Socket.io是一个实时传输框架, 可能会也可能不会使用Web套接字在客户端基于客户端的浏览器进行传输。
参考: FAQ - Socket.IO
(Answering my own question) I was behind a proxy that didn't allow the web socket connection from socket.io in my Win8 app through, and so it fell back on a method that required loading external resources.
Bypassing that problematic proxy, the connection works fine and I can use socket.io from my app as intended. I'm hosting the other end on Azure (per the node.js + socket.io tutorial they provide) and it works. I still don't know what a developer wanting to use the built-in web sockets library should use for a host, but I imagine we have to wait for IIS 8 to be out.
Now I'm left to verify that the app can pass certification with this library.
更多推荐
发布评论