3

This question basically makes it sound like the node library Socket.io uses the library engine.io which uses ws.

What role do each of these play given that each one can independantly create a WebSocket connection?

Community
  • 1
  • 1
Startec
  • 12,496
  • 23
  • 93
  • 160
  • Possible duplicate of [Which websocket library to use with Node.js?](http://stackoverflow.com/questions/16392260/which-websocket-library-to-use-with-node-js) – bolav Mar 02 '16 at 11:15

1 Answers1

2

Look at Introducing Socket.IO 1.0 - New engine to see why they made Engine.IO.

Engine.IO has all the browser hacks and different things for compatibility, and has modularised the Socket.IO codebase.

You are correct that Socket.IO uses Enginge.IO which uses ws.

  • Engine.IO takes care of the connection and browser hacks.
  • ws is used when upgrading to websockets.

Socket.IO handles:

  • setup/connection to http.Server. (but engine.io has this as well)
  • list of clients
  • rooms
  • namespaces
  • decoding/encoding of Socket.IO packet format
bolav
  • 6,938
  • 2
  • 18
  • 42