Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Latest commit

 

History

History
105 lines (74 loc) · 2.11 KB

File metadata and controls

105 lines (74 loc) · 2.11 KB

Server supports next actions:

'LOGIN NICK'
Allows you to change your nickname in chat to custom one. New nickname should be unique.

Params:

'nickname' - new nickname [string]

Example: {

'action': 'LOGIN NICK',
'nickname': 'Bob'

}

'JOIN ROOM'
Subscribe to new messages in selected room. If room does not exist, then it will be created.
Params:

'room_id' - room identifier [int or string]

Example: {

'action': 'JOIN ROOM',
'room_id': 'secret'

}

'LEFT ROOM'
Unsubscribe from new messages in selected room. If room is empty, it will be removed.
Params:

'room_id' - room identifier [int or string]

Example: {

'action': 'LEFT ROOM',
'room_id': 'flood'

}

'SEND MESSAGE'
Sends a message to selected room.
Params:

'room_id' - room identifier [int or string]
'text' - message text [string]

Example: {

'action': 'SEND MESSAGE',
'room_id': room_id,
'text': message

}

Server sends to client next actions:

'RESPONSE'
Requested command was successfully handled.
Params:

'request' - dict with successful request (same as described at server actions section) [dict]
'message' - response message text. Commonly "OK" [string]

Example: {

'action': 'RESPONSE',
'request': {
    'action': 'JOIN ROOM',
    'room_id': 'secret'
},
'message': 'OK',

}

'ERROR'
An error occured while processing requested command.
Params:

'request' - dict with failed request (same as described at server actions section) [dict]
'message' - error message text. [string]

Example: {

'action': 'ERROR',
'request': {
    'action': 'LOGIN NICK',
    'nickname': 'Bob'
},
'message': 'Nickname already in use',

}

'GET MESSAGE'
Recived message from one of rooms client subscribed on.
Params:

'room_id' - room identifier [int or string]
'author' - message author [string]
'text' - message text [string]

Example: {

'action': u'GET MESSAGE',
'room_id': 'secret',
'author': 'Alice',
'text': 'What I've done?',

}