Difference between socket and websocket?

前端 未结 5 956
逝去的感伤
逝去的感伤 2020-11-28 17:36

I\'m building web app that needs to communicate with another application using socket connections. This is new territory for me, so want to be sure that sockets are differen

5条回答
  •  离开以前
    2020-11-28 18:11

    You'd have to use WebSockets (or some similar protocol module e.g. as supported by the Flash plugin) because a normal browser application simply can't open a pure TCP socket.

    The Socket.IO module available for node.js can help a lot, but note that it is not a pure WebSocket module in its own right.

    It's actually a more generic communications module that can run on top of various other network protocols, including WebSockets, and Flash sockets.

    Hence if you want to use Socket.IO on the server end you must also use their client code and objects. You can't easily make raw WebSocket connections to a socket.io server as you'd have to emulate their message protocol.

提交回复
热议问题