Full Changelog: https://github.com/github/stable-socket/compare/v1.0.0...v1.1.0
Published by dgraham about 4 years ago
A stable release with no changes since 0.1.2.
Published by dgraham over 4 years ago
A web socket that reconnects.
$ npm install @github/stable-socket
import {StableSocket} from '@github/stable-socket'
const delegate = {
socketDidOpen(socket: Socket) {
// Socket is ready to write.
socket.send('Hello')
},
socketDidClose(socket: Socket, code?: number, reason?: string) {
// Socket closed and will retry the connection.
},
socketDidFinish(socket: Socket) {
// Socket closed for good and will not retry.
},
socketDidReceiveMessage(socket: Socket, message: string) {
// Socket read data from the connection.
}
}
const policy = {
timeout: 4000,
attempts: Infinity,
maxDelay: 60000
}
const socket = new StableSocket('wss://live.example.com', delegate, policy)
socket.open()