Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a draft and will probably be closed. The files in it should likely be merged into #905
This aims to do a few things:
First, eliminate the asymmetry between message formats going from the socket server to the API server and from the API server to the socket server. This is eventually because API server messages, or whatever replaces it, will be pushed in a fan-out way to multiple services potentially. They should not have a special length encoding.
The goal is to include the message type in the subject name in both directions. i.e. currently socket server pushes to
ipc.pb.3.userid.connid.whatever, which the API server picks up.3is the message type here. But API server pushes to channels that look likeuserid.abcdef, which do not contain the message type. Instead, there's an EventWrapper that adds the type and length of the packet to the binary encoding.This is unideal for several reasons:
The idea is to have all servers communicate with each other with the same binary protobuf. The message type would have to be included in the topic so that they know how to decode the protobuf. The API server could push, for example, to
userid.pb.4.abcdef.Then, the socket server would append the message type and length to the binary encoding right before sending it out to websocket consumers. It can also split it up into pieces, or even turn it into plain text, etc.
The socket server should be modified to be able to handle both types of messages. If
pb.xis in the topic name, it would add the length/type encoding before forwarding it on, otherwise, it just forwards the message on. Later on we can remove the legacy encoding.