ws-server API Reference

A distributed WebSocket Server with high level abstractions and HTTP APIs

Version: 0.1.0

Authentication

Room

Room API

POST /rooms/{roomName}/join

Join the specified room.

roomName: string
in path

Room Name

userIds: string[]
in query

User IDs, splited by comma.

204 No Content

OK

Response Content-Types: application/json

POST /rooms/{roomName}/push

Push message to all users in the specified room. All the request body JSON will be send.

roomName: string
in path

Room Name

200 OK

OK

Response Content-Types: application/json
Response Example (200 OK)
{
  "count": "integer"
}

User

User API

GET /users/{userId}/online

Check whether the user is online.

userId: string
in path

User ID

OK

Response Content-Types: application/json
Response Example (200 OK)
{
  "isOnline": "boolean"
}

POST /users/{userId}/push

Push message to specified user. All the request body JSON will be send.

userId: string
in path

User ID

200 OK

OK

Response Content-Types: application/json
Response Example (200 OK)
{
  "count": "integer"
}

POST /users/push

Push message to all specified users. All the request body JSON will be send.

待创建分类的信息

userIds: string[]

User IDs

string
Request Example
{
  "userIds": [
    "string"
  ]
}
200 OK

OK

Response Content-Types: application/json
Response Example (200 OK)
{
  "count": "integer"
}

Schema Definitions

userOnlineInfo: object

User

isOnline: boolean

Whether this user is online

Example
{
  "isOnline": "boolean"
}

pushCountRes: object

User

count: integer

The count of pushed users.

Example
{
  "count": "integer"
}