reading-notes
Project maintained by mr-atta
Hosted on GitHub Pages — Theme by mattgraham
Message Queues (13)
<hr>
What does it mean that web sockets are bidirectional? Why is this useful❓ 📁
- This enables the server to send real-time updates asynchronously, without requiring the client to submit a request each time. allows devices to send and receive continuous streams of data to and from any point on the network.
Does socket.io
use HTTP? Why❓ 📁
-
socket.io
server will attach to an HTTP server so it can serve its own client code through /socket.io
/socket.io
.js.
-
On top of the transport, it offers additional functionality like segmentation (namespaces, rooms), acknowledgements, broadcasts, etc.
-
socket.io
is a websocket library
What happens when a client emits an event❓ What happens when a server emits an event❓ 📁
-
When a click event happens, run the callback function that inside the listen(.on).
-
you can emit events on one side and register listeners on the other side.
socket.emit
will send back message to sender only,
io.emit
will send message to all the client including sender
- if you want to send message to all but not back to sender then
socket.broadcast.emit
What happens if a client “misses” an event❓ 📁
- will receive the response after he be connected
How can we mitigate this❓ 📁
Server
- Is a computer program or device that provides a service to another computer program and its user, also known as the client. In a data center, the physical computer that a server program runs on is also frequently referred to as a server.
Socket
- Java Socket programming is used for communication between the applications running on different JRE. … Socket and ServerSocket classes are used for connection-oriented socket programming
Web Socket
- WebSocket is the communication Protocol that provides bidirectional communication between the Client and the Server over a TCP connection
OSI Model
- (Open Systems Interconnection Model) is a conceptual framework used to describe the functions of a networking system.
Rooms
Reserved events:
- connect
- connect_error
- disconnect
- disconnecting
- newListener
- removeListener
<hr>
📁 Socket.io
Chat Example
📁Rooms and Namespaces
📁Socket.io
Emit Cheatsheet