admin管理员组文章数量:1194549
(JavaScript newbie)
I am trying to build a JavaScript based client app that communicates with a server app over socket. I came across socket.io. Is it possible to use socket.io without any node.js dependencies?
I have cloned socket.io github and wrote a simple client html to connect to the server (Can post the code if required). But it does not connect to the server.
(Background info: We need a simple config client utility that runs on Win32 that communicates with a custom server that supports socket communication with a custom packet-format protocol. Instead of going through the usual MFC/.NET, we think HTML/JS/CSS makes a better solution. For this purpose, I have considered the following options:
- Titanium: Works, but requires runtime to be installed
- HTML5 WebSocket: Not widely supported - works on Chrome but requires IE10
- socket.io: Trying to get it to work
- Any other? (Can post this question as separate thread, if necessary) )
(JavaScript newbie)
I am trying to build a JavaScript based client app that communicates with a server app over socket. I came across socket.io. Is it possible to use socket.io without any node.js dependencies?
I have cloned socket.io github and wrote a simple client html to connect to the server (Can post the code if required). But it does not connect to the server.
(Background info: We need a simple config client utility that runs on Win32 that communicates with a custom server that supports socket communication with a custom packet-format protocol. Instead of going through the usual MFC/.NET, we think HTML/JS/CSS makes a better solution. For this purpose, I have considered the following options:
- Titanium: Works, but requires runtime to be installed
- HTML5 WebSocket: Not widely supported - works on Chrome but requires IE10
- socket.io: Trying to get it to work
- Any other? (Can post this question as separate thread, if necessary) )
- Just use node-iis and socket.io together – Raynos Commented Nov 18, 2011 at 13:42
- What language do you write the server in? – Juliusz Gonera Commented Nov 24, 2011 at 8:55
- There's a project put together by Guillermo Rauch, entitled "Socket.io, Sockets for the rest of us" It does just what you're looking for, socket.io functionality without the added complexity of node.js github.com/LearnBoost/socket.io-client – Beachhouse Commented Nov 19, 2012 at 22:45
3 Answers
Reset to default 6Establish a successful Socket.IO, your custom server must follow the spec, or use other server implementation of socket.io
https://github.com/learnboost/socket.io/wiki the In other languages part include some servers implementation of socket.io
As I understand, you need a socket.io server without node.js, right? If to use socket.io just as cross-browser WebSockets would be sufficient, and what i mean by that is nicely illustrated in the following example from socket.io web site:
var socket = io.connect('http://localhost/');
socket.on('connect', function () {
socket.send('hi');
socket.on('message', function (msg) {
// my msg
});
});
It would make your server code very simple. Surely, you can find some WebSockets library for your language or even write your own. Look at this SO question for examples.
Or if you want to use socket.io protocol there is list of socket.io libraries for different languages, like python and java.
There's a lot of noise in the answers to the original question. Let me try to answer the question as clear as I can.
Is it possible to use socket.io without any node.js dependencies?
The short answer is yes. You will however have Flash dependency. You can read about how to do this in socket.io's faq.
本文标签: javascriptUsing socketio standalone without nodejsStack Overflow
版权声明:本文标题:javascript - Using socket.io standalone without node.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738503909a2090428.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论