News for hackers. Stuff that matters.
Re:Introducing Socket.io 1.0 by tlrobinson on Wednesday May 28, 2014 @02:12PM (#7811867)
I like the separation of the transports into engine.io, however it would be even better if it exposed a standard Node.js Stream interface so that it played nicely with the growing ecosystem of Stream-related modules.

Dominic Tarr, substack, and others have been advocating this idea for awhile: https://github.com/substack/stream-handbook

Gluing together various types of streams and stream transformers is a really nice way to build certain types of applications.

Fortunately it should be easy to write a Stream compatible wrapper.

Re:Introducing Socket.io 1.0 by bryanlarsen on Wednesday May 28, 2014 @02:39PM (#7811997)
Re:Introducing Socket.io 1.0 by tlrobinson on Wednesday May 28, 2014 @04:36PM (#7812702)
That probably works fine, but if it's encapsulating a stream over Socket.io's protocol then it's going to be much less efficient than the other way around.
Re:Introducing Socket.io 1.0 by V1 on Wednesday May 28, 2014 @03:44PM (#7812373)
You could also just use Primus which exposes a Stream compatible wrapper by default for the client and server.

https://github.com/primus/primus

(Primus uses engine.io,sockjs,browserchannel,websockets internally so you're no longer locked into a specific framework)

Re:Introducing Socket.io 1.0 by EGreg on Wednesday May 28, 2014 @04:00PM (#7812461)
someone should do primus vs socket.io

why would I need engine.io,websockets for example when engine.io already uses websockets if it can upgrade the connection to them?

Re:Introducing Socket.io 1.0 by lpinca on Wednesday May 28, 2014 @06:01PM (#7813244)
You can't use both. In Primus you can select only one transformer, listed above by V1, but if something doesn't work, you can just switch it with a single line of code. No rewrites, no need to learn a new API.
Re:Introducing Socket.io 1.0 by EGreg on Wednesday May 28, 2014 @08:36PM (#7813921)
I know you can't use both, but doesn't engine.io already support websockets?
Re:Introducing Socket.io 1.0 by lpinca on Thursday May 29, 2014 @02:45AM (#7815066)
Yes it does, but if you are building something that works perfectly only using websockets (e.g. a command-line utility), why would you use engine.io?

You can tell engine.io to only use websockets, but what's the point if you can use websockets directly and have the same API?