Yurba Docs
Yurba Documentation

Get started

Accounts

Apps

Users

Relationships

Dialogs (Messages)

Tracks (MuseBase)

Photos

Posts

Comments

Safety

Other

Yurba CDN (cdn.yurba.one)

For Desktop Developers

Websocket API

Yurba uses a secure websocket (wss) to receive messages/alerts and other events.

GET wss://api.yurba.one/ws

Query string:

token: string

Authorization

To receive websocket messages, you must connect to it using a user token. All messages come in the form of an EventModel. Some events are not global. They can be obtained by subscribing to a specific category.

{ Type: string, Message: model } A message is any model from the API, depending on the type.

Event types

Global

notification: NotificationModel (new notification)
message: MessageModel (on new message)
message_delete: MessageModel (on message delete)

Subscription

online: OnlineModel (on user went online)
typing: TypingModel
read: ReadModel

Subscription

To subscribe to the event category you should send the following json to the websocket, having connected in advance.

{ command: 'subscribe', category: string, thing_id: int }
Dialog
{ command: 'subscribe', category: 'dialog', thing_id: int # dialog ID }

TypingModel

Sent when someone writes a message in a dialog. Only those who subscribe to the dialog receive.

{ Dialog: int, User: ShortUserModel } More about ShortUserModel you can look here: /user/{user_id}

ReadModel

Sent when someone has read the dialog. Only those who subscribe to the dialog receive.

{ Dialog: int }