Spaces:
Runtime error
Runtime error
Changed 'message' to 'route'
Browse files- server/README.md +10 -10
server/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Both HTTP and WebSocket server are running on the same port
|
|
| 23 |
|
| 24 |
## WebSocket API
|
| 25 |
|
| 26 |
-
WebSockets payload will be in JSON and require atleast a `
|
| 27 |
Types can be `client -> server`, `server -> client <private | room>`.
|
| 28 |
Private messages are sent directly to client
|
| 29 |
Room messages are sent to everyone in a room
|
|
@@ -35,7 +35,7 @@ Room messages are sent to everyone in a room
|
|
| 35 |
|
| 36 |
```typescript
|
| 37 |
{
|
| 38 |
-
"
|
| 39 |
}
|
| 40 |
```
|
| 41 |
|
|
@@ -44,7 +44,7 @@ Room messages are sent to everyone in a room
|
|
| 44 |
|
| 45 |
```typescript
|
| 46 |
{
|
| 47 |
-
"
|
| 48 |
}
|
| 49 |
```
|
| 50 |
|
|
@@ -56,7 +56,7 @@ Room messages are sent to everyone in a room
|
|
| 56 |
|
| 57 |
```typescript
|
| 58 |
{
|
| 59 |
-
"
|
| 60 |
"roomId"?: string; // Room Id, optional
|
| 61 |
}
|
| 62 |
```
|
|
@@ -66,7 +66,7 @@ Room messages are sent to everyone in a room
|
|
| 66 |
|
| 67 |
```typescript
|
| 68 |
{
|
| 69 |
-
"
|
| 70 |
"roomId": string,
|
| 71 |
"users": []{
|
| 72 |
username: string,
|
|
@@ -86,7 +86,7 @@ Room messages are sent to everyone in a room
|
|
| 86 |
|
| 87 |
```typescript
|
| 88 |
{
|
| 89 |
-
"
|
| 90 |
"roomId": string; // Room Id, optional
|
| 91 |
}
|
| 92 |
```
|
|
@@ -96,7 +96,7 @@ Room messages are sent to everyone in a room
|
|
| 96 |
|
| 97 |
```typescript
|
| 98 |
{
|
| 99 |
-
"
|
| 100 |
"roomId": string,
|
| 101 |
"users": []{
|
| 102 |
username: string,
|
|
@@ -116,7 +116,7 @@ Room messages are sent to everyone in a room
|
|
| 116 |
|
| 117 |
```typescript
|
| 118 |
{
|
| 119 |
-
"
|
| 120 |
"roomId": string,
|
| 121 |
"users": []{
|
| 122 |
username: string,
|
|
@@ -135,7 +135,7 @@ Room messages are sent to everyone in a room
|
|
| 135 |
|
| 136 |
```typescript
|
| 137 |
{
|
| 138 |
-
"
|
| 139 |
"id": number, // Used to indentify vibrations for updating or disabling them
|
| 140 |
"type": "enable" | "disable", // Whether the vibration is active or not.
|
| 141 |
"position": {
|
|
@@ -155,7 +155,7 @@ Room messages are sent to everyone in a room
|
|
| 155 |
|
| 156 |
```typescript
|
| 157 |
{
|
| 158 |
-
"
|
| 159 |
"id": string, // format: [userID]_[id]
|
| 160 |
"type": "enable" | "disable", // Whether the vibration is active or not.
|
| 161 |
"user": {
|
|
|
|
| 23 |
|
| 24 |
## WebSocket API
|
| 25 |
|
| 26 |
+
WebSockets payload will be in JSON and require atleast a `route` property
|
| 27 |
Types can be `client -> server`, `server -> client <private | room>`.
|
| 28 |
Private messages are sent directly to client
|
| 29 |
Room messages are sent to everyone in a room
|
|
|
|
| 35 |
|
| 36 |
```typescript
|
| 37 |
{
|
| 38 |
+
"route": "test_connection"
|
| 39 |
}
|
| 40 |
```
|
| 41 |
|
|
|
|
| 44 |
|
| 45 |
```typescript
|
| 46 |
{
|
| 47 |
+
"route": "test_connection_response",
|
| 48 |
}
|
| 49 |
```
|
| 50 |
|
|
|
|
| 56 |
|
| 57 |
```typescript
|
| 58 |
{
|
| 59 |
+
"route": "enter_room",
|
| 60 |
"roomId"?: string; // Room Id, optional
|
| 61 |
}
|
| 62 |
```
|
|
|
|
| 66 |
|
| 67 |
```typescript
|
| 68 |
{
|
| 69 |
+
"route": "enter_room_response"
|
| 70 |
"roomId": string,
|
| 71 |
"users": []{
|
| 72 |
username: string,
|
|
|
|
| 86 |
|
| 87 |
```typescript
|
| 88 |
{
|
| 89 |
+
"route": "enter_room",
|
| 90 |
"roomId": string; // Room Id, optional
|
| 91 |
}
|
| 92 |
```
|
|
|
|
| 96 |
|
| 97 |
```typescript
|
| 98 |
{
|
| 99 |
+
"route": "enter_room_response"
|
| 100 |
"roomId": string,
|
| 101 |
"users": []{
|
| 102 |
username: string,
|
|
|
|
| 116 |
|
| 117 |
```typescript
|
| 118 |
{
|
| 119 |
+
"route": "room_update",
|
| 120 |
"roomId": string,
|
| 121 |
"users": []{
|
| 122 |
username: string,
|
|
|
|
| 135 |
|
| 136 |
```typescript
|
| 137 |
{
|
| 138 |
+
"route": "send_touch",
|
| 139 |
"id": number, // Used to indentify vibrations for updating or disabling them
|
| 140 |
"type": "enable" | "disable", // Whether the vibration is active or not.
|
| 141 |
"position": {
|
|
|
|
| 155 |
|
| 156 |
```typescript
|
| 157 |
{
|
| 158 |
+
"route": "receieve_touch",
|
| 159 |
"id": string, // format: [userID]_[id]
|
| 160 |
"type": "enable" | "disable", // Whether the vibration is active or not.
|
| 161 |
"user": {
|