Subscriptions
    • Dark
      Light
    • PDF

    Subscriptions

    • Dark
      Light
    • PDF

    Article summary

    Streams are a way of plugging into a continuous source of updates (changes). Any subscriber registered will receive the latest changes as they occur.

    Subscribe to a stream

    To subscribe to a stream, you must send a message with msg as sub, a unique ID, the stream name, and the parameters to be applied on the stream.

    {
        "msg": "sub",
        "id": "unique-id",
        "name": "the-stream",
        "params":[ "event", false ]
    }

    You must be logged in before you send any subscription request.

    Recent changes to the stream API aim to notify subscribers about changes more selectively, which could cause issues with existing drivers. To ensure compatibility, the back-compatibility boolean parameter is suggested as the last option. If set to true, subscribers will receive an "add" event whenever something new is created. This parameter allows subscribers to decide if they need to be notified about all changes or only specific ones, keeping things compatible with older drivers.

    Unsubscribe from a stream

    To unsubscribe from a room, send this request:

    {
        "msg": "unsub",
        "id": "subscription-id"
    }

    The response will look like this:

    {
        "msg": "nosub",
        "id": "subscription-id"
    }

    When you make a call to an invalid or non-existent subscription_id, the response will not produce an error. Instead, it will respond with at least a "msg" field set to "nosub" and include the provided id value. If no id was provided, the id field will be omitted from the response.


    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.
    ESC

    Eddy AI, facilitating knowledge discovery through conversational intelligence