WebSockets Extension

Typically, communication between Versia instances is done via HTTP. However, HTTP suffers from some limitations, such as high latency and heavy overhead for small messages, making it less suitable for exchanging large amounts of entities at acceptable speeds.

This extension aims to address these limitations by adding support for the exchange of entities using WebSockets.

Message Format

Messages sent over the WebSocket connection are JSON objects.

  • Name
    signature
    Required
    Required
    Type
    string
    Description

    Same as the Versia-Signature header in HTTP requests.

  • Name
    signed_at
    Required
    Required
    Type
    string
    Description

    Same as the Versia-Signed-At header in HTTP requests.

  • Name
    signed_by
    Required
    Required
    Type
    URI
    Description

    Same as the Versia-Signed-By header in HTTP requests.

  • Name
    entity
    Required
    Required
    Type
    Entity
    Description

    Same as the request body in HTTP requests. Must be a string (stringified JSON), not JSON.

Example Message

{
    "signature": "/CjB2L9bcvRg+uP19B4/rqy7Ji9/cqMFPlL3GVCIndnQjYyOpBzJEAl9weDnXm7Jrqa3y6sBC+EYWKThO2r9Bw==",
    "signed_at": "1729241807",
    "signed_by": "https://bongo.social/users/63a00ab3-39b1-49eb-b88e-ed65d2361f3e",
    "entity": "{\"id\":\"9a8928b6-2526-4979-aab1-ef2f88cd5700\",\"type\":\"Delete\",\"created_at\":\"2022-01-01T12:00:00Z\",\"author\":\"https://bongo.social/users/63a00ab3-39b1-49eb-b88e-ed65d2361f3e\",\"deleted\":\"https://bongo.social/notes/54059ce2-9332-46fa-bf6a-598b5493b81b\"}"
}

Connection Establishment

...