The WebSocket API (WebSockets) - Web APIs 编辑

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 away cross-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.
  • WebSocket King: A client tool to help develop, test and work with WebSocket servers.

Specifications

SpecificationStatusComments
HTML Living Standard
The definition of 'WebSocket API' in that specification.
Living Standard
WebSocketsCandidate Recommendation
RFC 6455: The WebSocket ProtocolIETF RFC

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:135 次

字数:6696

最后编辑:6年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文