This content originally appeared on DEV Community and was authored by FaxriddinMaxmadiyorov
I am going to build a chat server in Ruby’s sockets library. Before this, let’s clarify what sockets are. Sockets are the endpoints of the communication channels. There are two types of sockets:
- Stream sockets – These sockets use Transmission Control Protocol (TCP) for communication. They provide a reliable, connection-oriented communication channel. Web servers and clients (HTTP/HTTPS) use this kind of sockets.
- Datagram sockets – These sockets use User Datagram protocol for communication. They are less reliable than TCP sockets and are used in streaming.
This content originally appeared on DEV Community and was authored by FaxriddinMaxmadiyorov