Message Queues
What does it mean that web sockets are bidirectional? Why is this useful?
BIDIRECTIONAL. Whereas HTTP relies on a client request to receive a response from the server for every exchange, WebSockets allow for full-duplex bidirectional communication. This enables the server to send real-time updates asynchronously, without requiring the client to submit a request each time. In the context of networked AV and control systems, this allows devices to send and receive continuous streams of data to and from any point on the network.
Does socket.io use HTTP? Why?
Even when websockets can be used, the initial connection setup it done over HTTP. Also, a socket.io server will attach to an HTTP server so it can serve its own client code through /socket.io/socket.io.js.
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. Inside the callback function, have socket emit event to the server. Along with the event socket emits, pass the JSON data.
Bind the socket to this server. Then listen to the connection event. When that event is invoked, socket.io pass a socket object to our function. We then listen to all of our sockets . As defined on the client side, take the data emited and emit it back to all of our sockets.
What happens if a client “misses” an event? How can we mitigate this?
If the client misses that first “connect” everything else came apart. This is basically fire and forget functionally, these messages are not buffered internally for when a client is unable to receive messages for example if the client has network issues or if the client uses a polling transport and is in the middle of a request/response cycle. Usong Handlers.
Terms:
| Term | Def |
|---|---|
| Socket | A socket is one endpoint of a two-way communication link between two programs running on the network. A socket is bound to a port number so that the TCP layer can identify the application that data is destined to be sent to. |
| Web Socket | The WebSocket object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection. |
| Socket.io | ocket.IO is a library that enables real-time, bidirectional and event-based communication between the browser and the server. |
| Client | person or group that uses the professional advice or services of a lawyer, accountant, advertising agency, architect, etc. a person who is receiving the benefits, |
| Server | A server is a computer or system that provides resources, data, services, or programs to other computers, known as clients, over a network. In theory, whenever computers share resources with client machines they are considered servers. |
| OSI Model | The OSI Model (Open Systems Interconnection Model) is a conceptual framework used to describe the functions of a networking system. The OSI model characterizes computing functions into a universal set of rules and requirements in order to support interoperability between different products and software. In the OSI reference model, the communications between a computing system are split into seven different abstraction layers: Physical, Data Link, Network, Transport, Session, Presentation, and Application. |
| TCP Model | In computer science, a call stack is a stack data structure that stores information about the active subroutines of a computer program. This kind of stack is also known as an execution stack, program stack, control stack, run-time stack, or machine stack, and is often shortened to just “the stack”. Although maintenance of the call stack is important for the proper functioning of most software, the details are normally hidden and automatic in high-level programming languages. Many computer instruction sets provide special instructions for manipulating stacks. |
| TCP | The TCP/IP model is a concise version of the OSI model. It contains four layers, unlike seven layers in the OSI model. |
| UDP | (User Datagram Protocol) is a communications protocol that is primarily used for establishing low-latency and loss-tolerating connections between applications on the internet. |
| Packets | In networking, a packet is a small segment of a larger message. Data sent over computer networks*, such as the Internet, is divided into packets. These packets are then recombined by the computer or device that receives them. |