WebSockets Extension
This document is provided for informative purposes and should not be used in a production environment. It is subject to change.
If internal testing proves unsuccessful at solving the problems with the HTTP delivery method, this document may be abandoned.
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
X-Signature
header in HTTP requests.
- Name
nonce
- Required
- Required
- Type
- string
- Description
Same as the
X-Nonce
header in HTTP requests.
- Name
signed_by
- Required
- Required
- Type
- URI
- Description
Same as the
X-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": "post /users/1/inbox a2ebc29eb6762a9164fbcffc9271e8a53562a5e725e7187ea7d88d03cbe59341 n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=",
"nonce": "a2ebc29eb6762a9164fbcffc9271e8a53562a5e725e7187ea7d88d03cbe59341",
"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
...