paint-brush
HTML5 Websockets API Introduction and Toolsby@mozilla
955 reads
955 reads

HTML5 Websockets API Introduction and Tools

by Mozilla ContributorsMay 18th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

HTML5 Websockets API is an advanced technology that makes it possible to open a two-way interactive communication session between the user's browser and a server. With this API, you can send messages to a server and receive event-driven responses without having to poll the server for a reply. While a WebSocket connection is functionally somewhat similar to standard Unix-style sockets, they are not related. The WebSocket API is a free software community founded in 1998 by members of Netscape and Mozilla.
featured image - HTML5 Websockets API Introduction and Tools
Mozilla Contributors HackerNoon profile picture

The WebSocket API is an advanced technology that makes it possible to open a two-way interactive communication session between the user's browser and a server. With this API, you can send messages to a server and receive event-driven responses without having to poll the server for a reply.

Note: While a WebSocket connection is functionally somewhat similar to standard Unix-style sockets, they are not related.

Interfaces

WebSocket

The primary interface for connecting to a WebSocket server and then sending and receiving data on the connection.

CloseEvent

The event sent by the WebSocket object when the connection closes.

MessageEvent

The event sent by the WebSocket object when a message is received from the server.

Guides

Tools

  • HumbleNet: A cross-platform networking library that works in the browser. It consists of a C wrapper around WebSockets and WebRTC that abstracts awaycross-browser differences, facilitating the creation of multi-user networking functionality for games and other apps.
  • µWebSockets: Highly scalable WebSocket server and client implementation for C++11 and Node.js.
  • ClusterWS:  Lightweight, fast and powerful framework for building scalable WebSocket applications in Node.js.
  • CWS: Fast C++ WebSocket implementation for Node.js (uWebSockets v0.14 fork)
  • Socket.IO: A long polling/WebSocket based third party transfer protocol for Node.js.
  • SocketCluster: A pub/sub WebSocket framework for Node.js with a focus on scalability.
  • WebSocket-Node: A WebSocket server API implementation for Node.js.
  • Total.js: Web application framework for Node.js (Example: WebSocket chat)
  • Faye: A WebSocket (two-ways connections) and EventSource (one-way connections) for Node.js Server and Client.
  • SignalR: SignalR will use WebSockets under the covers when it's available, and
    gracefully fallback to other techniques and technologies when it isn't, while your application code stays the same.
  • Caddy: A web server capable of proxying arbitrary commands (stdin/stdout) as a websocket.
  • ws: a popular WebSocket client & server library for Node.js.
  • jsonrpc-bidirectional: Asynchronous RPC which, on a single connection, may have functions exported on the server and, and the same time, on the client (client may call server, server may also call client).
  • cowboy: Cowboy is a small, fast and modern HTTP server for Erlang/OTP with WebSocket support.

Related Topics

Specifications

Browser compatibility

See also

Credits