Connections
Connectivity through the internet
The basis of internet connectivity relies, aside from the physical aspects of the connection, with protocols and standards that are given by the W3C. They are largely in charge of enforcing methodologies and ideas through multiple entities that are directly involved in the web.
Specifically, the protocols and directives that are directly used by the library are the following:
- Web Sockets: Technology for opening two-way interactive communication between server and browser.
- HTTP Long Polling: Checking data from a server through a fixed interval of time.
- WebRTC: Real time communication between browsers without relying on server traffic.
The libraries utilizes these technologies through abstractions implemented from the following relying dependencies:
- Socket.IO: A library that utilizes web sockets and long polling to create secure and reliant server-side bidirectional communication.
- Peer.js: Library that uses WebRTC through an easier API interface that allows easier setup between peers.
- Node.js: Library that allows the development of applications that can run in servers and client side.
Bidirectional Connection
Real-time communication between servers and clients is achieved through either long pooling or web sockets. The main purpose is to keep a connection alive through specified connectivity between the server and peer, allowing for both to listen to requests as needed.

Reference: Guide to WebSockets
P2P Connection
Connectivity between two peers can be achived through the use of the WebRTC standard. It is implemented across all major web browsers through an API, requiring a set of handshakes through a signaling server, working mostly as a broker that connects two peers together. Through the use of the implemented libraries, the connection enables a low latency communication highway that permits data transfers of any kind between peers.

Reference: How WebRTC works on Medium
More about connection technologies here.