ReconnectingWebSocket
ReconnectingWebSocket 是一个小型的 JavaScript 库,封装了 WebSocket API 提供了在连接断开时自动重连的机制。采用JavaScript开发并在MIT协议下授权。只需要简单的将:ws = new WebSocket('ws://....');
替换成:ws = new ReconnectingWebSocket('ws://....');.
A small JavaScript library that decorates the WebSocket API to provide a WebSocket connection that will automatically reconnect if the connection is dropped.
最新版本:
项目主页:https://github.com/joewalnes/reconnecting-websocket/