Skip to content

Conversation

@domino14
Copy link
Collaborator

@domino14 domino14 commented Feb 5, 2022

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. 3 is the message type here. But API server pushes to channels that look like userid.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:

  • limits packet length artificially
  • receivers will have different ways to decode different messages. In the future the socket server should not be the only receiver.
  • others?

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.x is 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.

@domino14 domino14 marked this pull request as draft February 5, 2022 00:12
@domino14 domino14 closed this Feb 6, 2022
@domino14 domino14 deleted the remove-wrapevent branch February 6, 2022 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants