Skip to content

Latest commit

 

History

History
49 lines (25 loc) · 2.19 KB

Reading-4-12.md

File metadata and controls

49 lines (25 loc) · 2.19 KB

Socket.io

  1. Web Socket is a communication protocol that allows for two-way data transfer over a single TCP connection.

  2. The client sends a handshake request, the server sends a handshake response, then the client and server can send web socket data back and forth

  3. Web Sockets provide a standardized way for the server to send content to a client without first receiving a request from that client.

  1. The io.on event handler handles connection, disconnection, etc., events in it, using the socket object.

  2. Console log whenever a connection or disconnect event happens.

  3. socket.emit creates and fires a custom event.

  1. Web Socket is a protocol and socket.io is a library that implements that protocol.

A seven layer standard for getting things to connect to each other.

  1. Application: a set of protocols to help application connect, e.g. http or ftp

  2. Presentation: establishes data formatting and is responsible for translation (e.g. ASCII to base64), data compression, and encryption.

  3. Session: sets up and manages connections, including DNS and authentication/authorization

  4. Transport: maintains integrity of transfer, coordinating transfer rates, segmenting and reassembling data, and chacking that all data got the destination.

  5. Network: the map that tells you how to get from one node to another.

  6. Data Link: Lets individual machines talk to the network

  7. Physical: The actual physical machine; converts digital data into a transmission medium, e.g. electrical or radio signals.

  1. TCP is a 3 step protocol to establis a connection between te server and client.

    1. The client says "I would like to open a connection. Here's what you need to connect to me."

    2. The server says "Great, you are connected. Here's what you need to make it a two way connection."

    3. The client says "Swell, we now have a two-way connection."