aridevelopment-de / fabric-packet-logger

Client-side packet logger with web-ui
https://modrinth.com/mod/packetlogger
GNU Affero General Public License v3.0
20 stars 6 forks source link

Using a chunked-based approach when sending data via websocket #17

Closed Ari24-cb24 closed 1 year ago

Ari24-cb24 commented 1 year ago

To improve ws performance, the following approach should be considered:

BasiqueEvangelist commented 1 year ago

Couldn't you use a port of DataInputStream to JS for metadata?

lbirkert commented 1 year ago

To improve ws performance, the following approach should be considered:

* A chunk of Packets should be collected, compressed and then send via websocket

* Packet data should be reduced by a lot (e.g.)

  * Do not include packet metadata (such as packet name), only the packet id
  * Field names should be reduced to a single character
  * When connecting, a mapping is being send via websocket which includes the actual names of the variables
  * Maybe considering a shorter format than json

Packets could be sent to the frontend using the original protocol form prepended with the packet state (s>c/c>s) and some other metadata (received at, ...) encoded into a header.

lbirkert commented 1 year ago

Websockets should be able to handle this stream of binary data

Ari24-cb24 commented 1 year ago

Implemented at #19
I still use json data but in a more convenient way and with much less data at all. Might switch over to a stream of binary data but this should be sufficient for now as I need to develop some other things in the meantime.