WebSockets

The API provides a WebSocket endpoint for real-time communication.

Connecting

To connect to the WebSocket server, use the following URL:

ws://{base}/ws?token=${token}

You must provide a valid JWT token as a query parameter.

Events

The server will send events to the client. The following events are supported:

new_comment

Sent when a new comment is posted on a post you created.

Payload
{
    "type": "new_comment",
    "payload": {
        "post_id": 1,
        "comment_id": 35,
        "commenter_id": 2
    }
}

post_like

Sent when a user likes a post you created.

Payload
{
    "type": "post_like",
    "payload": {
        "post_id": 1,
        "liker_id": 3
    }
}

new_follower

Sent when a user follows you.

Payload
{
    "type": "new_follower",
    "payload": {
        "follower_id": 4
    }
}

Last updated