1
0
Fork
You've already forked lucyboard
0

📝 added documentation for websocket RPC-Framework #2

Merged
ninanonemon merged 3 commits from websocket-protocol into main 2026年05月19日 23:00:48 +02:00
No description provided.
Collaborator
Copy link

Hmm, it feels both a bit over-engineered and also a bit too "loose". Having a request-based system will complicate the socket-handling a lot since the component that handled messages needs to keep track of message IDs, and which component/subject is supposed to handle that specific request/response. I'm assuming whether or not a specific request expects a response depends on the action of the request? In that case the websocket component additionally needs to be aware of the which actions require responses, so the response messages can be parsed correctly.

I wonder if you could reduce the coupling between the different request-emitting/response-receiving components to the websocket handling component by splitting requests that require a response from requests that don't. I've seen a pattern in the past that uses "call" vs "event" instead of "request". "call" expect a response, while "event" doesn't. "updateScoreboard" would be an "event" because it does not have any returned data and doesn't require callbacks.

Alternatively: If you want to make sure that all messages definitely arrive, then don't make responses optional. Right now the document says "maybe", but there is an argument to be made that no requests should be async - everything needs an acknowledgement response. I think I refer the first option but both would drastically reduce the complexity of the protocol implementation I think.

Hmm, it feels both a bit over-engineered and also a bit too "loose". Having a request-based system will complicate the socket-handling a lot since the component that handled messages needs to keep track of message IDs, and which component/subject is supposed to handle that specific request/response. I'm assuming whether or not a specific request expects a response depends on the action of the request? In that case the websocket component additionally needs to be aware of the which actions require responses, so the response messages can be parsed correctly. I wonder if you could reduce the coupling between the different request-emitting/response-receiving components to the websocket handling component by splitting requests that require a response from requests that don't. I've seen a pattern in the past that uses "call" vs "event" instead of "request". "call" expect a response, while "event" doesn't. "updateScoreboard" would be an "event" because it does not have any returned data and doesn't require callbacks. Alternatively: If you want to make sure that all messages definitely arrive, then don't make responses optional. Right now the document says "maybe", but there is an argument to be made that no requests should be async - everything needs an acknowledgement response. I think I refer the first option but both would drastically reduce the complexity of the protocol implementation I think.
Author
Owner
Copy link

@sigmasternchen wrote in #2 (comment):

There are definitely messages where I want to be sure that they have arrived, for example if a penalty was submitted.

The reason why I wrote maybe, is that the response to a call can be a "error" too. I think I should clarify that.

Adding "event" messages is a good Idea. In rollerderby/scoreboard clients can subscribe to "events", something which would be easier to model with an "event" message type.

@sigmasternchen wrote in https://codeberg.org/ninanonemon/lucyboard/pulls/2#issuecomment-15211916: There are definitely messages where I want to be sure that they have arrived, for example if a penalty was submitted. The reason why I wrote maybe, is that the response to a call can be a "error" too. I think I should clarify that. Adding "event" messages is a good Idea. In rollerderby/scoreboard clients can subscribe to "events", something which would be easier to model with an "event" message type.
Author
Owner
Copy link

@sigmasternchen what do you think now? I added a event message type.

@sigmasternchen what do you think now? I added a `event` message type.
sigmasternchen approved these changes 2026年05月19日 20:49:20 +02:00
Dismissed
@ -0,0 +35,4 @@
a clear relation, the RPC protocol used in this project
uses Message IDs to create links between messages.
The Message ID must be different for any `request` or `send` message.
Collaborator
Copy link

Well there be a defined way of making sure the IDs are different? Like some combination of a timestamp + subject?

Well there be a defined way of making sure the IDs are different? Like some combination of a timestamp + subject?
Author
Owner
Copy link

UUIDs? :D

UUIDs? :D
Author
Owner
Copy link

Or thinking about it again uilds: https://github.com/ulid/spec these contain a timestamp.

Or thinking about it again uilds: https://github.com/ulid/spec these contain a timestamp.
@ -0,0 +73,4 @@
#### result
A `result` or a `error` must send as response to a `request`.
Collaborator
Copy link

Could it happen that a request has multiple responses?

Could it happen that a `request` has multiple responses?
Author
Owner
Copy link

No

No
@ -0,0 +88,4 @@
#### error
A `error` is maybe send as response to a `request`.
Collaborator
Copy link

I'd probably also add something about that there can not be an error and a result at the same time.

An `error` may be sent as a response to a `request`. There can only be either a `response` or an `error` with the same message id.
I'd probably also add something about that there can not be an error and a result at the same time. ``` An `error` may be sent as a response to a `request`. There can only be either a `response` or an `error` with the same message id. ```
Author
Owner
Copy link

Added! Thank you!

Added! Thank you!
@ -0,0 +113,4 @@
A `result_error` can be send as response to `result`.
The message is the same as `error`.
Collaborator
Copy link

What's the use case for this? It seems like it would complicate things a lot.

What's the use case for this? It seems like it would complicate things a lot.
Author
Owner
Copy link

request -> result -> result_error

The client sends a request, the server replies, but because the answer is malformed, the client sends back an result_error.

Do you think this is too much?

request -> result -> result_error The client sends a request, the server replies, but because the answer is malformed, the client sends back an result_error. Do you think this is too much?
Author
Owner
Copy link

I removed it

I removed it
ninanonemon dismissed sigmasternchen's review 2026年05月19日 22:16:36 +02:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ninanonemon/lucyboard!2
Reference in a new issue
ninanonemon/lucyboard
No description provided.
Delete branch "websocket-protocol"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?