Skip to content

Instantly share code, notes, and snippets.

@kissarat
Created December 12, 2020 20:33
Show Gist options
  • Save kissarat/6c3795a7674256f6936f6892120de982 to your computer and use it in GitHub Desktop.
Save kissarat/6c3795a7674256f6936f6892120de982 to your computer and use it in GitHub Desktop.
{
"type": "object",
"required": ["type"],
"properties": {
"_id": {
"type": "string",
"pattern": "^[0-9a-f]{24}$",
"description": "id повідомлення, ганарнтує, що при повторні спробі відправити повідомлення воно не буде збережено двічі в БД"
},
"type": {
"type": "string",
"enum": ["open", "join", "message", "typing", "leave", "timeout", "ping", "pong"],
"description": "Фронтенд може відправляти join, message, typing, leave, ping"
},
"source": {
"type": "string",
"pattern": "^[0-9a-f]{24}$",
"description": "id користувача-відправника у разі відправки повідомлення, встановлюється на бекенді"
},
"target": {
"type": "string",
"pattern": "^[0-9a-f]{24}$",
"description": "id користувача-отримувача, обов'язково вказується на фронтенді у разі відповіді від support"
},
"text": {
"type": "string",
"description": "Вміст повідомлення, вказується лише при типі message"
},
"close": {
"type": "boolean",
"description": "Використовується при типі leave, після отримання такого повідомлення закриє всі веб-сокети відправника"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment