advantage engine.io towards socket.io

advantage engine.io towards socket.io

Problem

I’m new to node.js and set up a simple chat application with socket.io. I realizied the installed modules together with express need 30MB. Is engine.io more slim? does it has advantages towards use engine.io ?

Problem courtesy of: daisy

Solution

Engine.io is more of a lower library of Socket.io. If you want the lower level abstraction use engine, if you want a websocket abstraction keep using socket.io. Engine.io is of more interest to you if your building a library/framework on top of socket.io. Unlike the previous socket.io core, it always establishes a long-polling connection first, then tries to upgrade to better transports that are “tested” on the side. The main goal of Engine is ensuring the most reliable realtime communication. Unlike the previous socket.io core which rely on HTML5 websockets and Flash socket as the first communcation mechanism. You can also use this to set the order in socket.io

io.set('transports', [ 'websocket', 'xhr-polling' ]);

WebSocket isn’t supported by IE, Android < 4.0 and not every IOS so it’s good to have it fallback to XHR-polling.

http://caniuse.com/#search=websockets

Android has Java libraries that can be included to get websockets working for Android 2.3 but it runs rather slow.

Solution courtesy of: Josh Bedo

Discussion

Leave a Reply

Your email address will not be published. Required fields are marked *