Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/geut/socket-signal-websocket
socket-signal through simple-websocket
https://github.com/geut/socket-signal-websocket
reconnecting-websocket simple-websocket socket-signal webrtc websocket
Last synced: 3 months ago
JSON representation
socket-signal through simple-websocket
- Host: GitHub
- URL: https://github.com/geut/socket-signal-websocket
- Owner: geut
- License: mit
- Created: 2020-03-15T18:59:56.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-29T15:19:12.000Z (almost 3 years ago)
- Last Synced: 2024-10-13T01:15:43.583Z (4 months ago)
- Topics: reconnecting-websocket, simple-websocket, socket-signal, webrtc, websocket
- Language: JavaScript
- Size: 2.83 MB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# socket-signal-websocket
[![Build Status](https://travis-ci.com/geut/socket-signal-websocket.svg?branch=master)](https://travis-ci.com/geut/socket-signal-websocket)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)> socket-signal through simple-websocket and reconnecting support
```
$ npm install socket-signal-websocket
```### Server
```
$ npx socket-signal-websocket [--port=4000]
```### Client
```javascript
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
}
})()
```:bug: If you found an issue we encourage you to report it on [github](https://github.com/geut/socket-signal-websocket/issues). Please specify your OS and the actions to reproduce it.
:busts_in_silhouette: Ideas and contributions to the project are welcome. You must follow this [guideline](https://github.com/geut/socket-signal-websocket/blob/master/CONTRIBUTING.md).
## License
MIT © A [**GEUT**](http://geutstudio.com/) project