I'd be surprised if the general speed of the connection over time was different between web browsers, but the reason you'll see a delay in the initial connection in Internet Explorer and in Opera is that native WebSocket support is not available as it's been disabled by default. So, if you choose FlashSocket then an additional Flash object (SWF file) will need to be downloaded before a connection is established.
WebSockets are being introduced in IE10 and in Opera they are available, but disabled by default.
What is the difference between the mode of transport - XHR-polling and flash / websocket?
- XHR-polling - see http://en.wikipedia.org/wiki/Push_technology#Long_polling
- FlashSocket connection - uses a Flash Socket object to establish a connection to the WebSocket server and communicates using the WebSocket protocol. This means there is interaction between Flash and JavaScript and also means an additional Flash object (SWF files) will need to be downloaded.
What is the best mode of transportation?
WebSockets for any Web Browser that natively supports it (Chrome, Firefox, Safari). If the Flash object (SWF file) is in the browser cache then connection should be fast. If it's not then there will be a delay. XHR Long-Polling is a good solution and will work cross browser but there are negatives:
- between poll requests the data on display could be out of date (stale).
- It's a less efficient connection method than a single TCP connection used by WebSockets since HTTP Long-Polling uses multiple connection to simulate bi-directional functionality
- HTTP has an overhead which means additional header information is sent upon request and each subsequent request.
How to optimize the connection speed is socket.io?
(I'm pretty new to socket.io to this is just a suggestion)
I'd look at the configuring Socket.io docs and see if you can conditionally set the transports
based on the browser that is connecting. Based on your experiences this could be:
- Chrome, Firefox, Safari - WebSockets
- IE, Opera - XHR-Polling