This is our blog

We have a few tips for you.


Socket.IO

  • Socket.IO enables real-time bidirectional event-based communication.
  • It works on every platform, browser or device, focusing equally on reliability and speed.

Real-time analytics

Push data to clients that gets represented as real-time counters, charts or logs.

Binary streaming

Starting in 1.0, it’s possible to send any blob back and forth: image, audio, video.

Instant messaging and chat

Socket.IO’s “Dither” is a lifestyle app in just a few lines of code with instant comments and votes.

Document collaboration

Allow users to concurrently edit a document and see each other’s changes.

Example Project: Dither

  • Dither is a Mobile Application for both IOS and android, to connect with people who are friends in Facebook and share images in collage view both real-time capturing and uploading.
  • The other person can compare the images/ snaps (we call it dither) in collage and vote or comment for their favorite ones.
  • Thus the  user  gets real time opinion from their friends.  
  • For this, we used the socket.IO technology

 

Go through the Dither given below, you can see the instant updates of news feed, new votes and comments.  

This icon would indicate that someone is typing at the other end, In the meantime, system emits a socket to the server, then the server broadcasts to the other users in the chat room.

  • When the user comments, votes, mentions, or asks opinion on any dithers, socket receives an update for the same.
  • It’s a real-time bidirectional event-based communication using Socket.IO.
  • It consists of a Node.js server
  • We have used it in both Android Java and IOS Swift platform

The main features of Socket.IO are :

Reliability

Connections are established even in the presence of

  • proxies and load balancers.
  • personal firewall and antivirus software.

For this purpose, it relies on Engine.IO, which first establishes a long-polling connection, then tries to upgrade to better transports that are “tested” on the side, like WebSocket. 

Auto-reconnection support

Unless instructed, a disconnected client will try to reconnect forever, until the server is available again. 

Disconnection detection

A  heartbeat mechanism is implemented at the Engine.IO level, allowing both the server and the client to know when the other one is not responding anymore.

That functionality is achieved with timers set on both the server and the client, with timeout values (the ping Interval and ping Timeout parameters) shared during the connection handshake. Those timers require any subsequent client calls to be directed to the same server, hence the sticky-session requirement when using multiples nodes.

Binary support

Any serializable data structures can be emitted, including:

  • ArrayBuffer and Blob in the browser
  • ArrayBuffer and Buffer in Node.js

Simple and convenient API

Sample code:

Multiplexing support

In order to create separation of concerns within your application (for example per module, or based on permissions), Socket.IO allows you to create several Namespaces, which will act as separate communication channels but will share the same underlying connection.

Room support

Within each Namespace, you can define arbitrary channels, called Rooms, that sockets can join and leave. You can then broadcast to any given room, reaching every socket that has joined it.

This is a useful feature to send notifications to a group of users, or to a given user connected on several devices for example.

Note: Socket.IO is not a WebSocket implementation. Although Socket.IO indeed uses WebSocket as a transport when possible, it adds some metadata to each packet: the packet type, the namespace and the ack id when a message acknowledgement is needed. That is why a WebSocket client will not be able to successfully connect to a Socket.IO server, and a Socket.IO client will not be able to connect to a WebSocket server (like ws://echo.websocket.org) either.