Spaces:
Runtime error
Runtime error
Formatted readme and added get_user_info
Browse files- server/README.md +47 -14
server/README.md
CHANGED
|
@@ -31,24 +31,38 @@ Room messages are sent to everyone in a room
|
|
| 31 |
## Test Connection
|
| 32 |
|
| 33 |
**Type:** `client -> server`
|
| 34 |
-
**Payload:**
|
| 35 |
|
| 36 |
```typescript
|
| 37 |
{
|
| 38 |
"route": "test_connection"
|
| 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",
|
|
@@ -56,12 +70,29 @@ Room messages are sent to everyone in a room
|
|
| 56 |
}
|
| 57 |
```
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
**Type:** `server -> client <private>`
|
| 60 |
-
**
|
| 61 |
|
| 62 |
```typescript
|
| 63 |
{
|
| 64 |
-
"message": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
}
|
| 66 |
```
|
| 67 |
|
|
@@ -69,7 +100,7 @@ Room messages are sent to everyone in a 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 |
{
|
|
@@ -80,7 +111,7 @@ Room messages are sent to everyone in a room
|
|
| 80 |
```
|
| 81 |
|
| 82 |
**Type:** `server -> client <private>`
|
| 83 |
-
**Payload (If error):**
|
| 84 |
|
| 85 |
```typescript
|
| 86 |
{
|
|
@@ -93,7 +124,7 @@ Room messages are sent to everyone in a room
|
|
| 93 |
|
| 94 |
**Type:** `client -> server`
|
| 95 |
**Description:** Used to enter a room.
|
| 96 |
-
**Payload:**
|
| 97 |
|
| 98 |
```typescript
|
| 99 |
{
|
|
@@ -103,7 +134,7 @@ Room messages are sent to everyone in a room
|
|
| 103 |
```
|
| 104 |
|
| 105 |
**Type:** `server -> client <private>`
|
| 106 |
-
**Payload:**
|
| 107 |
|
| 108 |
```typescript
|
| 109 |
{
|
|
@@ -116,7 +147,8 @@ Room messages are sent to everyone in a room
|
|
| 116 |
|
| 117 |
**Type:** `client -> server`
|
| 118 |
**Description:** Used to get list of joined rooms
|
| 119 |
-
**Payload:**
|
|
|
|
| 120 |
```typescript
|
| 121 |
{
|
| 122 |
"route": "get_rooms"
|
|
@@ -124,7 +156,8 @@ Room messages are sent to everyone in a room
|
|
| 124 |
```
|
| 125 |
|
| 126 |
**Type:** `server -> client <private>`
|
| 127 |
-
**Payload:**
|
|
|
|
| 128 |
```typescript
|
| 129 |
{
|
| 130 |
"message": "get_rooms_response",
|
|
@@ -136,7 +169,7 @@ Room messages are sent to everyone in a room
|
|
| 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 |
{
|
|
@@ -155,7 +188,7 @@ Room messages are sent to everyone in a room
|
|
| 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 creation/last update it will automatically be disabled.
|
| 158 |
-
**Payload:**
|
| 159 |
|
| 160 |
```typescript
|
| 161 |
{
|
|
@@ -175,7 +208,7 @@ Room messages are sent to everyone in a room
|
|
| 175 |
|
| 176 |
**Type:** `server -> client <room>`
|
| 177 |
**Description:**
|
| 178 |
-
**Payload:**
|
| 179 |
|
| 180 |
```typescript
|
| 181 |
{
|
|
|
|
| 31 |
## Test Connection
|
| 32 |
|
| 33 |
**Type:** `client -> server`
|
| 34 |
+
**Payload:**
|
| 35 |
|
| 36 |
```typescript
|
| 37 |
{
|
| 38 |
"route": "test_connection"
|
| 39 |
}
|
| 40 |
```
|
| 41 |
+
|
| 42 |
+
**Type:** `server -> client <private>`
|
| 43 |
+
**Response:**
|
| 44 |
+
|
| 45 |
+
```typescript
|
| 46 |
+
{
|
| 47 |
+
"message": "test_connection_response",
|
| 48 |
+
}
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
## Set Username
|
| 52 |
+
|
| 53 |
**Type:** `client -> server`
|
| 54 |
+
**Payload:**
|
| 55 |
+
|
| 56 |
```typescript
|
| 57 |
{
|
| 58 |
"route": "set_username",
|
| 59 |
"username": string,
|
| 60 |
}
|
| 61 |
```
|
| 62 |
+
|
| 63 |
**Type:** `server -> client <private>`
|
| 64 |
+
**Payload:**
|
| 65 |
+
|
| 66 |
```typescript
|
| 67 |
{
|
| 68 |
"message": "set_username_response",
|
|
|
|
| 70 |
}
|
| 71 |
```
|
| 72 |
|
| 73 |
+
## Get User Info
|
| 74 |
+
|
| 75 |
+
**Type:** `client -> server`
|
| 76 |
+
**Payload:**
|
| 77 |
+
|
| 78 |
+
```typescript
|
| 79 |
+
{
|
| 80 |
+
"route": "get_user_info",
|
| 81 |
+
}
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
**Type:** `server -> client <private>`
|
| 85 |
+
**Payload:**
|
| 86 |
|
| 87 |
```typescript
|
| 88 |
{
|
| 89 |
+
"message": "set_username_response",
|
| 90 |
+
"status": string,
|
| 91 |
+
"user": {
|
| 92 |
+
"username": string,
|
| 93 |
+
"id": string,
|
| 94 |
+
"currentRoom": string,
|
| 95 |
+
}
|
| 96 |
}
|
| 97 |
```
|
| 98 |
|
|
|
|
| 100 |
|
| 101 |
**Type:** `client -> server`
|
| 102 |
**Description:** Used to enter a room. Join an existing room by including roomId, or if room doesn't exist, create one with that roomId
|
| 103 |
+
**Payload:**
|
| 104 |
|
| 105 |
```typescript
|
| 106 |
{
|
|
|
|
| 111 |
```
|
| 112 |
|
| 113 |
**Type:** `server -> client <private>`
|
| 114 |
+
**Payload (If error):**
|
| 115 |
|
| 116 |
```typescript
|
| 117 |
{
|
|
|
|
| 124 |
|
| 125 |
**Type:** `client -> server`
|
| 126 |
**Description:** Used to enter a room.
|
| 127 |
+
**Payload:**
|
| 128 |
|
| 129 |
```typescript
|
| 130 |
{
|
|
|
|
| 134 |
```
|
| 135 |
|
| 136 |
**Type:** `server -> client <private>`
|
| 137 |
+
**Payload:**
|
| 138 |
|
| 139 |
```typescript
|
| 140 |
{
|
|
|
|
| 147 |
|
| 148 |
**Type:** `client -> server`
|
| 149 |
**Description:** Used to get list of joined rooms
|
| 150 |
+
**Payload:**
|
| 151 |
+
|
| 152 |
```typescript
|
| 153 |
{
|
| 154 |
"route": "get_rooms"
|
|
|
|
| 156 |
```
|
| 157 |
|
| 158 |
**Type:** `server -> client <private>`
|
| 159 |
+
**Payload:**
|
| 160 |
+
|
| 161 |
```typescript
|
| 162 |
{
|
| 163 |
"message": "get_rooms_response",
|
|
|
|
| 169 |
|
| 170 |
**Type:** `server -> client <room>`
|
| 171 |
**Description:** Server message that is sent when the room gets updated such as someone joins or leaves
|
| 172 |
+
**Payload:**
|
| 173 |
|
| 174 |
```typescript
|
| 175 |
{
|
|
|
|
| 188 |
|
| 189 |
**Type:** `client -> server`
|
| 190 |
**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 creation/last update it will automatically be disabled.
|
| 191 |
+
**Payload:**
|
| 192 |
|
| 193 |
```typescript
|
| 194 |
{
|
|
|
|
| 208 |
|
| 209 |
**Type:** `server -> client <room>`
|
| 210 |
**Description:**
|
| 211 |
+
**Payload:**
|
| 212 |
|
| 213 |
```typescript
|
| 214 |
{
|