A brief introduction about Sockets programming

Socket.IO is a javascript library that allows real-time bi-directional data flow. This means users can access the updated data without refreshing the whole page.


Sockets.IO is based on a web sockets API that allows a tunnel for direct communication with client-side and server-side.




So the server can't send messages on its own to the client. The browser has to must refreshed and the message is requested from the server. However, sockets.io allows for instantaneous communication.


In long-polling, the client will send AJAX like a request to the server. With a suitable timeout, the server would send back a response if there was an update. Here the client will continuously or periodically send request updates from the server, Through separate TCP connections, congesting network traffic.


In short-polling, the client periodically sends a request to the server asking if there's anything new. The server doesn't wait, but rather sends back if there's an update or just an empty message. Here the network gets even more congested with these continuous requests, even when there are no updates.


WebSocket


WebSockets can be regarded as the future of client-server communication. In WebSockets, there would be one TCP connection between the client & server at all times. There's the bi-directional data flow between client & server as well as real-time nature due to always open TCP connection.


Socket.io can also be used in real-time communication, This means without sending the request to the server-client will get the updated date. By using socket.emit on the server-side and to catch the request socket.on at the client-side.


How can we use it


Socket.Io can be used to get real-time updates from the server. How about the old days before sockets.io, we have to refresh our browser to get updated messages or data. How about time-consuming and the internet, with the help of sockets we get real updates nowadays everyone is using social media and we get real-time notifications when a user comments on a post or liked a post without refreshing the app or loading it again.

Which types of apps use sockets?


Sockets are widely used in chat applications like or customer care support we get a real-time update when we message a friend and the message is rendered in his UI without refreshing his app, and when he typing we also see that he is typing a reply for us, What about youtube when a user comments on video comment will shows on comment section without refreshing our browsers, there are lots of apps using web sockets popular among them or Facebook Messenger WhatsappWechat.

Summary 


  • Reliability: It can establish a connection even in the presence of proxies,load-balancers, personal firewalls, and antivirus software.
  • Auto-reconnect Support: Unless mentioned explicitly in the code, the client library will try to reconnect forever, until the server is available again.
  • Disconnection detection: It allows both the server and the client to know when the other one is not responding anymore.
  • Multiplexing support: It allows us to have several communication channels on the same underlying connection.
  • Binary Streaming support: It also allows emitting any serializable binary data likeArrayBuffer, Blobs, etc.
how-to-setup-backend-environment-in-ubuntu-1804

How to setup back-end environment in Ubuntu 18.04

When working back end development you usually work with languages such as, Node JS, Php, Python, Ruby, Java etc. You have to seutp the development environment for these languages. With the help of this article you setup backend development environment on your Ubuntu 18.04 machine.

how-to-create-zip-files-by-using-jszip-library

How to Create Zip files by using JSZIP library

JS Zip is an open-source and free library to easily create Zip files without any pain which provides an easy and good API. You can use this library in your app to build easily Zip files. You can use this library when you want your users to download their data, like their images, their videos, their documents, and their other data.

a-brief-introduction-to-microservices-apps

A brief Introduction to Microservices Apps

Microservice apps, or simply microservices, is a method of developing software systems that tries on building single-function modules with interfaces and operations. The trend has grown popular in recent years as Enterprises look to become more Agile and move towards DevOps and continuous testing.