Skip to content

Отправить сообщение через WebSocket

Request

STOMP destination для отправки сообщений через WebSocket.

Подключение:

  • SockJS endpoint: /ws
  • STOMP destination: /app/chat.send

Клиент отправляет тот же payload, что и REST-эндпоинт отправки сообщения.

Ответы:

  • в ответ отправителю приходит сообщение в /user/queue/chat.delivered
  • собеседнику отправляется уведомление в /user/queue/chat.new_message
  • ошибки приходят в /user/queue/errors
Bodyapplication/jsonrequired
textstring or null, <= 4000 characters
filesArray of integers or null, <= 10 items

Список ID файлов сообщения. Можно передать не более 10 файлов.

dialog_idinteger or null, (int64), >= 1
receiver_idinteger or null, (int64), >= 1
reply_message_idinteger or null, (int64), >= 1
curl -i -X POST \
  https://felmee.com/app/chat.send \
  -H 'Content-Type: application/json' \
  -d '{
    "dialog_id": 10,
    "reply_message_id": 99,
    "text": "Hello",
    "files": [
      60
    ]
  }'

Responses

Доставка сообщения отправителю в /user/queue/chat.delivered

Bodyapplication/json
dialog_idinteger, (int64)required
messagesArray of objects(MessageResponse)required
Response
{ "dialog_id": 10, "messages": [ {} ] }