Spaces:
Runtime error
Runtime error
Added line-breaks I think
Browse files- server/README.md +34 -33
server/README.md
CHANGED
|
@@ -30,8 +30,8 @@ Room messages are sent to everyone in a room
|
|
| 30 |
|
| 31 |
### Test Connection
|
| 32 |
|
| 33 |
-
**Type:** `client -> server`
|
| 34 |
-
**Payload:**
|
| 35 |
|
| 36 |
```typescript
|
| 37 |
{
|
|
@@ -39,24 +39,25 @@ Room messages are sent to everyone in a room
|
|
| 39 |
}
|
| 40 |
```
|
| 41 |
### Set Username
|
| 42 |
-
**Type:** `client -> server`
|
| 43 |
-
**Payload:**
|
| 44 |
```typescript
|
| 45 |
{
|
| 46 |
"route": "set_username",
|
| 47 |
"username": string,
|
| 48 |
}
|
| 49 |
```
|
| 50 |
-
**Type:** `server -> client <private>`
|
| 51 |
-
**Payload:**
|
| 52 |
```typescript
|
| 53 |
{
|
| 54 |
"message": "set_username_response",
|
| 55 |
"status": string,
|
| 56 |
}
|
|
|
|
| 57 |
|
| 58 |
-
**Type:** `server -> client <private>`
|
| 59 |
-
**Response:**
|
| 60 |
|
| 61 |
```typescript
|
| 62 |
{
|
|
@@ -66,9 +67,9 @@ Room messages are sent to everyone in a room
|
|
| 66 |
|
| 67 |
### Join Room
|
| 68 |
|
| 69 |
-
**Type:** `client -> server`
|
| 70 |
-
**Description:** Used to enter a room. Join an existing room by including roomId, or if room doesn't exist, create one with that roomId
|
| 71 |
-
**Payload:**
|
| 72 |
|
| 73 |
```typescript
|
| 74 |
{
|
|
@@ -78,8 +79,8 @@ Room messages are sent to everyone in a room
|
|
| 78 |
}
|
| 79 |
```
|
| 80 |
|
| 81 |
-
**Type:** `server -> client <private>`
|
| 82 |
-
**Payload (If error):**
|
| 83 |
|
| 84 |
```typescript
|
| 85 |
{
|
|
@@ -90,9 +91,9 @@ Room messages are sent to everyone in a room
|
|
| 90 |
|
| 91 |
### Leave Room
|
| 92 |
|
| 93 |
-
**Type:** `client -> server`
|
| 94 |
-
**Description:** Used to enter a room.
|
| 95 |
-
**Payload:**
|
| 96 |
|
| 97 |
```typescript
|
| 98 |
{
|
|
@@ -101,8 +102,8 @@ Room messages are sent to everyone in a room
|
|
| 101 |
}
|
| 102 |
```
|
| 103 |
|
| 104 |
-
**Type:** `server -> client <private>`
|
| 105 |
-
**Payload:**
|
| 106 |
|
| 107 |
```typescript
|
| 108 |
{
|
|
@@ -113,17 +114,17 @@ Room messages are sent to everyone in a room
|
|
| 113 |
|
| 114 |
### Get Rooms
|
| 115 |
|
| 116 |
-
**Type:** `client -> server`
|
| 117 |
-
**Description:** Used to get list of joined rooms
|
| 118 |
-
**Payload:**
|
| 119 |
```typescript
|
| 120 |
{
|
| 121 |
"route": "get_rooms"
|
| 122 |
}
|
| 123 |
```
|
| 124 |
|
| 125 |
-
**Type:** `server -> client <private>`
|
| 126 |
-
**Payload:**
|
| 127 |
```typescript
|
| 128 |
{
|
| 129 |
"message": "get_rooms_response",
|
|
@@ -133,9 +134,9 @@ Room messages are sent to everyone in a room
|
|
| 133 |
|
| 134 |
### Room Update
|
| 135 |
|
| 136 |
-
**Type:** `server -> client <room>`
|
| 137 |
-
**Description:** Server message that is sent when the room gets updated such as someone joins or leaves
|
| 138 |
-
**Payload:**
|
| 139 |
|
| 140 |
```typescript
|
| 141 |
{
|
|
@@ -152,9 +153,9 @@ Room messages are sent to everyone in a room
|
|
| 152 |
|
| 153 |
### Send Touch
|
| 154 |
|
| 155 |
-
**Type:** `client -> server`
|
| 156 |
-
**Description:** Used to send touch/vibration data to room. Client assigns a number for an ID. That ID is then used to update the vibration. Re-use `send_touch` to update previous vibration. Use `"type": "disable"` to disable the vibration. If an update isn't sent within 1 second of creatin/last update it will automatically be disabled.
|
| 157 |
-
**Payload:**
|
| 158 |
|
| 159 |
```typescript
|
| 160 |
{
|
|
@@ -172,9 +173,9 @@ Room messages are sent to everyone in a room
|
|
| 172 |
|
| 173 |
### Receive Touch
|
| 174 |
|
| 175 |
-
**Type:** `server -> client <room>`
|
| 176 |
-
**Description:**
|
| 177 |
-
**Payload:**
|
| 178 |
|
| 179 |
```typescript
|
| 180 |
{
|
|
@@ -196,5 +197,5 @@ Room messages are sent to everyone in a room
|
|
| 196 |
|
| 197 |
## API
|
| 198 |
|
| 199 |
-
**GET** `/`
|
| 200 |
Responds with homepage.
|
|
|
|
| 30 |
|
| 31 |
### Test Connection
|
| 32 |
|
| 33 |
+
**Type:** `client -> server`
|
| 34 |
+
**Payload:**
|
| 35 |
|
| 36 |
```typescript
|
| 37 |
{
|
|
|
|
| 39 |
}
|
| 40 |
```
|
| 41 |
### Set Username
|
| 42 |
+
**Type:** `client -> server`
|
| 43 |
+
**Payload:**
|
| 44 |
```typescript
|
| 45 |
{
|
| 46 |
"route": "set_username",
|
| 47 |
"username": string,
|
| 48 |
}
|
| 49 |
```
|
| 50 |
+
**Type:** `server -> client <private>`
|
| 51 |
+
**Payload:**
|
| 52 |
```typescript
|
| 53 |
{
|
| 54 |
"message": "set_username_response",
|
| 55 |
"status": string,
|
| 56 |
}
|
| 57 |
+
```
|
| 58 |
|
| 59 |
+
**Type:** `server -> client <private>`
|
| 60 |
+
**Response:**
|
| 61 |
|
| 62 |
```typescript
|
| 63 |
{
|
|
|
|
| 67 |
|
| 68 |
### Join Room
|
| 69 |
|
| 70 |
+
**Type:** `client -> server`
|
| 71 |
+
**Description:** Used to enter a room. Join an existing room by including roomId, or if room doesn't exist, create one with that roomId
|
| 72 |
+
**Payload:**
|
| 73 |
|
| 74 |
```typescript
|
| 75 |
{
|
|
|
|
| 79 |
}
|
| 80 |
```
|
| 81 |
|
| 82 |
+
**Type:** `server -> client <private>`
|
| 83 |
+
**Payload (If error):**
|
| 84 |
|
| 85 |
```typescript
|
| 86 |
{
|
|
|
|
| 91 |
|
| 92 |
### Leave Room
|
| 93 |
|
| 94 |
+
**Type:** `client -> server`
|
| 95 |
+
**Description:** Used to enter a room.
|
| 96 |
+
**Payload:**
|
| 97 |
|
| 98 |
```typescript
|
| 99 |
{
|
|
|
|
| 102 |
}
|
| 103 |
```
|
| 104 |
|
| 105 |
+
**Type:** `server -> client <private>`
|
| 106 |
+
**Payload:**
|
| 107 |
|
| 108 |
```typescript
|
| 109 |
{
|
|
|
|
| 114 |
|
| 115 |
### Get Rooms
|
| 116 |
|
| 117 |
+
**Type:** `client -> server`
|
| 118 |
+
**Description:** Used to get list of joined rooms
|
| 119 |
+
**Payload:**
|
| 120 |
```typescript
|
| 121 |
{
|
| 122 |
"route": "get_rooms"
|
| 123 |
}
|
| 124 |
```
|
| 125 |
|
| 126 |
+
**Type:** `server -> client <private>`
|
| 127 |
+
**Payload:**
|
| 128 |
```typescript
|
| 129 |
{
|
| 130 |
"message": "get_rooms_response",
|
|
|
|
| 134 |
|
| 135 |
### Room Update
|
| 136 |
|
| 137 |
+
**Type:** `server -> client <room>`
|
| 138 |
+
**Description:** Server message that is sent when the room gets updated such as someone joins or leaves
|
| 139 |
+
**Payload:**
|
| 140 |
|
| 141 |
```typescript
|
| 142 |
{
|
|
|
|
| 153 |
|
| 154 |
### Send Touch
|
| 155 |
|
| 156 |
+
**Type:** `client -> server`
|
| 157 |
+
**Description:** Used to send touch/vibration data to room. Client assigns a number for an ID. That ID is then used to update the vibration. Re-use `send_touch` to update previous vibration. Use `"type": "disable"` to disable the vibration. If an update isn't sent within 1 second of creatin/last update it will automatically be disabled.
|
| 158 |
+
**Payload:**
|
| 159 |
|
| 160 |
```typescript
|
| 161 |
{
|
|
|
|
| 173 |
|
| 174 |
### Receive Touch
|
| 175 |
|
| 176 |
+
**Type:** `server -> client <room>`
|
| 177 |
+
**Description:**
|
| 178 |
+
**Payload:**
|
| 179 |
|
| 180 |
```typescript
|
| 181 |
{
|
|
|
|
| 197 |
|
| 198 |
## API
|
| 199 |
|
| 200 |
+
**GET** `/`
|
| 201 |
Responds with homepage.
|