Socket.io
Review, Research, and Discussion
- What is the benefit of transforming data into packets?
- to meet the demands of pervasive data-centric applications and services.
- UDP is often refereed to as a connectionless protocol. Why is this?
-
because it is analogous to sending a letter where you don’t acknowledge receipt.
- Can a socket server application have multiple socket connections?
- yes it can handel 65535 socket connections.
- Can a socket connection application be connected to multiple socket servers?
- Yes, a socket connection application can connect to multiple socket server Theoretically but it is not practical.
- Can an application be both a socket server and a socket connection?
- Yes, it can be applied.
Vocabulary Terms
Observer Pattern :
- it maintain a collection of observers to notify them in case of any change of state happens.
Listener :
- waits for an event to occur.
Event Handler :
- code to be executed when an event occurs.
Event Driven Programming :
- where the execution of the code depends on events occurrence.
Event Loop :
- way of handling the execution of the code.
Event Queue :
- a queue of events waiting to be executed.
Call Stack :
- rganizing the code in the order of its execution.
Emit/Raise/Trigger :
- to fire an event.
Subscribe :
- a function that defines how to obtain or generate values or messages to be published.
database :
- a collection of data that enable the programmer to CRUD.
WebSocket
- it is a computer communications protocol, providing full-duplex communication channels over a single TCP connection.
- WebSocket is distinct from HTTP. Both protocols are located at layer 7 in the OSI model and depend on TCP at layer 4.
- WebSocket remains open all the time.
- enables interaction between a web browser (or other client application) and a web server with lower overhead than half-duplex alternatives such as HTTP polling.
-
by providing a standardized way for the server to send content to the client without being first requested by the client.
-
allowing messages to be passed back and forth while keeping the connection open.
-
a two-way ongoing conversation can take place between the client and the server.
- Socket.IO is a library that enables real-time and full-duplex communication between the Client and the Web servers.
- It uses the WebSocket protocol to provide the interface, it is divided into two parts;
both WebSocket
vsSocket.io
are event-driven libraries.