72 lines
886 B
Markdown
72 lines
886 B
Markdown
# room-rs
|
|
|
|
ENV:
|
|
```
|
|
PASS=pass ./target/debug/room-rs
|
|
```
|
|
|
|
Slash commands:
|
|
* /exit - close current websocket
|
|
* /statics - show statics
|
|
* /pass <pass> - set pass
|
|
* /rooms - show rooms
|
|
* /room <room id> - show room clients
|
|
* /version - show version\[admin]
|
|
* /time - show time
|
|
|
|
# Message format
|
|
|
|
Enter room:
|
|
```json
|
|
{
|
|
"type": "Enter",
|
|
"roomId": "<roomid>",
|
|
"clientId": "<clientid>"
|
|
}
|
|
```
|
|
|
|
Exit room:
|
|
```json
|
|
{
|
|
"type": "Exit"
|
|
}
|
|
```
|
|
|
|
Destroy room:
|
|
```json
|
|
{
|
|
"type": "Destroy"
|
|
}
|
|
```
|
|
|
|
List room peers:
|
|
```json
|
|
{
|
|
"type": "ListPeers"
|
|
}
|
|
```
|
|
|
|
Broadcast room message:
|
|
```json
|
|
{
|
|
"type": "Broadcast",
|
|
"data": "<message>"
|
|
}
|
|
```
|
|
|
|
Send room peer message:
|
|
```json
|
|
{
|
|
"type": "Peer",
|
|
"peerId": "<peerclientid>",
|
|
"data": "<message>"
|
|
}
|
|
```
|
|
|
|
Test with command line:
|
|
> WebSocket cat: https://www.npmjs.com/package/wscat
|
|
|
|
Install `wscat` with `npm`:
|
|
```shell
|
|
npm install -g wscat
|
|
``` |