📝 added documentation for websocket RPC-Framework #2
websocket-protocol into main 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.
@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.
cf67dc0b0d
to 6ce24f38c1
6ce24f38c1
to 0900685925
@sigmasternchen what do you think now? I added a event message type.
@ -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.
Well there be a defined way of making sure the IDs are different? Like some combination of a timestamp + subject?
UUIDs? :D
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`.
Could it happen that a request has multiple responses?
No
@ -0,0 +88,4 @@
#### error
A `error` is maybe send as response to a `request`.
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.
Added! Thank you!
@ -0,0 +113,4 @@
A `result_error` can be send as response to `result`.
The message is the same as `error`.
What's the use case for this? It seems like it would complicate things a lot.
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?
I removed it
03f5a23f50
to a08e2da74c
No due date set.
No dependencies set.
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?