English 中文(简体)
Socket.IO - Overview
  • 时间:2024-12-22

Socket.IO - Overview


Previous Page Next Page  

Socket.IO is a JavaScript pbrary for real-time web apppcations. It enables real-time, bi-directional communication between web cpents and servers. It has two parts − a cpent-side pbrary that runs in the browser, and a server-side pbrary for node.js. Both components have an identical API.

Real-time Apppcations

A real-time apppcation (RTA) is an apppcation that functions within a period that the user senses as immediate or current.

Some examples of real-time apppcations are −

    Instant messengers − Chat apps pke Whatsapp, Facebook Messenger, etc. You need not refresh your app/website to receive new messages.

    Push Notifications − When someone tags you in a picture on Facebook, you receive a notification instantly.

    Collaboration Apppcations − Apps pke google docs, which allow multiple people to update same documents simultaneously and apply changes to all people s instances.

    Onpne Gaming − Games pke Counter Strike, Call of Duty, etc., are also some examples of real-time apppcations.

Why Socket.IO?

Writing a real-time apppcation with popular web apppcations stacks pke LAMP (PHP) has traditionally been very hard. It involves polpng the server for changes, keeping track of timestamps, and it is a lot slower than it should be.

Sockets have traditionally been the solution around which most real-time systems are architected, providing a bi-directional communication channel between a cpent and a server. This means that the server can push messages to cpents. Whenever an event occurs, the idea is that the server will get it and push it to the concerned connected cpents.

Socket.IO is quite popular, it is used by Microsoft Office, Yammer, Zendesk, Trello,. and numerous other organizations to build robust real-time systems. It one of the most powerful JavaScript frameworks on GitHub, and most depended-upon NPM (Node Package Manager) module. Socket.IO also has a huge community, which means finding help is quite easy.

ExpressJS

We will be using express to build the web server that Socket.IO will work with. Any other node-server-side framework or even node HTTP server can be used. However, ExpressJS makes it easy to define routes and other things. To read more about express and get a basic idea about it, head to – ExpressJS tutorial.

Advertisements