Using socket.io standalone without node.js

后端 未结 3 867
旧巷少年郎
旧巷少年郎 2020-12-03 10:39

(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 us

相关标签:
3条回答
  • 2020-12-03 10:51

    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.

    0 讨论(0)
  • 2020-12-03 11:09

    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.

    0 讨论(0)
  • 2020-12-03 11:15

    Establish 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

    0 讨论(0)
提交回复
热议问题