Skip to content

Latest commit

 

History

History
76 lines (54 loc) · 3.98 KB

File metadata and controls

76 lines (54 loc) · 3.98 KB

Message Queues

Review, Research, and Discussion

What does it mean that web sockets are bidirectional? Why is this useful?

  • Bidirectional means that the server can send real-time updates asynchronously, without requiring the client to submit a request each time. This is useful in videogames, realtime messaging apps, or any other use case where realtime data flow is important.

Does socket.io use HTTP? Why?

  • socket.io tries to make a Web Socket connection as it's first priotiry, if that is not available due to browser or firewalls, then it falls back on a HTTP connection as a failsafe. source
    • also sounds like it might try to make a HTTP request first, when once connected "Upgrade" to a web socket, since if a web socket connection is rejected it can cause a delay of up to 10 seconds for the user. source

What happens when a client emits an event?

  • its basically sending a Node.js EventEmitter, for listeners to capture

What happens when a server emits an event?

  • works the same way as the client

What happens if a client “misses” an event?

  • By default, any event emitted while the Socket is not connected will be buffered until reconnection.

How can we mitigate this?

  • by using volitile events or emptying the internal buffer upon reconnection

Vocab

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. source

Web Socket

  • A web socket is a communication protocol, that unlike HTTP is bidirectional. It starts with ws:// or wss:// and is stateful, meaning it will stay active until terminated. source

Socket.io

  • Socket.IO is a library that enables real-time, bidirectional and event-based communication between the browser and the server source

Client

  • A computer accessing a server.

Server

  • dedicated computer or computer that plays a role to provide services to clients

OSI Model

  • Open Systems Interconnection (not currently used on Internet) source
  • OSI Model

TCP Model

  • Transmission Control Protocol/Internet Protocol 4 layers:
  • Process/Application Layer
  • Host-to-Host/Transport Layer
  • Internet Layer
  • Network Access/Link Layer
  • source

TCP

  • a connection-oriented protocol. Connection-orientation means that the communicating devices should establish a connection before transmitting data and should close the connection after transmitting the data. source

UDP

  • Datagram-oriented protocol. This is because there is no overhead for opening a connection, maintaining a connection, and terminating a connection. UDP is efficient for broadcast and multicast types of network transmission. source

Packets

  • are used to break data down into smaller pieces for faster transmission, which is then reassembled upon reciept

Preview

Which 3 things had you heard about previously and now have better clarity on?

  • Socket.io, TCP Model, UDP

Which 3 things are you hoping to learn more about in the upcoming lecture/demo?

  • Socket.io, Web Sockets, Packets

What are you most excited about trying to implement or see how it works?

  • Socket.io

Resources