Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SockJS or Socket.IO? Worth to recode ajax-based page? [closed]

Which one's better: Socket.IO or SockJS and what are the biggest differences?

How difficult is it to rebuild a completely ajax based page into a node.JS / socket.io based page? Do I have to recode absolutely everything? Are there any good tutorials on how to do this? Is it worth to do it (in your opinion)?

like image 380
Patrick DaVader Avatar asked Apr 26 '12 21:04

Patrick DaVader


People also ask

Which is better WebSockets or socket IO?

Key Differences between WebSocket and socket.io It provides the Connection over TCP, while Socket.io is a library to abstract the WebSocket connections. WebSocket doesn't have fallback options, while Socket.io supports fallback. WebSocket is the technology, while Socket.io is a library for WebSockets.

Does socket IO use Ajax?

SocketIO is built on top of the WebSocket protocol (RFC 6455). It was designed to replace AJAX entirely. It does not have scalability issues what-so-ever.

What is SockJS node?

SockJS is a JavaScript library (for browsers) that provides a WebSocket-like object. SockJS gives you a coherent, cross-browser, Javascript API which creates a low latency, full duplex, cross-domain communication channel between the browser and the web server, with WebSockets or without.

Is socket IO JavaScript library?

Socket.IO is a library that enables real-time, bidirectional and event-based communication between the browser and the server. It consists of: a Node. js server: Source | API.


1 Answers

SockJS has more server-side options available. If you don't want to be tied to Node.js, then it may be an option. The scaling seems to work best, from some benchmarks using PyPy to host the server-side portion.

socket.io has more transport options, which include Flash. Even if you don't like flash, it does have the option for a real WebSocket transport, which may work better depending on your implementation desires.

The fact is, either will get the job done, it just depends on your desires. I would suggest creating a trivial application in each, and see if one's APIs feel more natural to you.

Personally, I'm more inclined to use socket.io ... I will also say that if you need to scale using clusters, you will probably also need to map out a strategy to use a pub/sub server (such as redis) as different requests may come to different processes that don't share memory state.


Also worth noting, is there is a similar framework for .Net called SignalR ...

like image 70
Tracker1 Avatar answered Oct 02 '22 09:10

Tracker1