10.0.7 • Published 2 years ago
socket-signal-websocket v10.0.7
socket-signal-websocket
socket-signal through simple-websocket and reconnecting support
Install
$ npm install socket-signal-websocket
Usage
Server
$ npx socket-signal-websocket [--port=4000]
Client
const { SocketSignalWebsocketClient } = require('socket-signal-websocket')
// you can define multiple server urls for fallback reconnections
const client = new SocketSignalWebsocketClient([
'ws://localhost:4000',
'ws://localhost:4001',
'ws://localhost:4002'
], {
heartbeat: {
interval: 10 * 1000,
timeout: 5 * 1000
},
simpleWebsocket: {}, // https://github.com/feross/simple-websocket options
reconnectingWebsocket: {}, // https://github.com/pladaria/reconnecting-websocket options
simplePeer: {} // https://github.com/feross/simple-peer options
})
;(async () => {
await client.open()
client.onIncomingPeer(async (peer) => {
if (validPeer(peer)) return
throw new Error('invalid peer')
})
const peersForThatTopic = await client.join(topic)
const remotePeer = client.connect(topic, peersForThatTopic[0])
try {
await remotePeer.ready()
// SimplePeer connected
} catch(err) {
// SimplePeer rejected
}
})()
Issues
:bug: If you found an issue we encourage you to report it on github. Please specify your OS and the actions to reproduce it.
Contributing
:busts_in_silhouette: Ideas and contributions to the project are welcome. You must follow this guideline.
License
MIT © A GEUT project
10.0.7
2 years ago
10.0.6
2 years ago
10.0.5
3 years ago
9.2.4
3 years ago
9.2.3
3 years ago
10.0.2
3 years ago
10.0.3
3 years ago
10.0.4
3 years ago
10.0.1
3 years ago
10.0.0
3 years ago
9.2.2
3 years ago
9.2.1
3 years ago
9.2.0
3 years ago
9.1.0
3 years ago
9.0.2
4 years ago
9.0.1
4 years ago
9.0.0
4 years ago
8.0.0
4 years ago
7.0.0
4 years ago
6.0.0
4 years ago
5.1.0
4 years ago
5.0.0
4 years ago
4.0.0
4 years ago
3.0.0
4 years ago
2.0.0
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.0
4 years ago