Files
room-rs/README.md
2023-11-05 19:38:19 +08:00

102 lines
1.1 KiB
Markdown

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