An open API service indexing awesome lists of open source software.

https://github.com/thgh/websocket-room

Alternative to websocket.in
https://github.com/thgh/websocket-room

Last synced: about 1 year ago
JSON representation

Alternative to websocket.in

Awesome Lists containing this project

README

          

websocket-room
---

This websocket server will broadcast all messages it receives to sockets connected to the same URL.

Client-side, you can connect with `new WebSocket(url)`, or use the wrapper in `public/connectable.js` that will try to reconnect.

```
// Connect to `room-name`
const socket = connectable('ws://localhost:8080/room-name')

// Log all messages in `room-name`
socket.subscribe(console.log)

// Send a chat message
form.onsubmit = () => socket.send(nameInput.value)
```