CatCore icon indicating copy to clipboard operation
CatCore copied to clipboard

Draft: Feature/socket client

Open Fernthedev opened this issue 2 years ago • 0 comments

The purpose of this PR is a few:

  • Track the progress of the socket implementation
  • Discuss the direction of the implementation
  • Document and draft the specifications of the protocol

While this is designed for a Quest companion mod in mind, it would be nice to have it generalized for other use cases such as multi-computer setups (maybe?).

Currently, I've yet to decide on whether protobuf or JSON serialization will be used. If we go with JSON, serialization and data classes are simpler and easy to write. The problem then is deserializing (securely) fast and safely. Methods of deserializing JSON:

  • Delimeter: Use a char such as \n to split strings. While easy as this may be, it could be equally complex to handle safely when the delimeter char is used for non-delimeter purposes.
  • Length prepend: This is the more complex though safer approach. It involves either reserving a number of bytes as padding or sending before the actual data to define the length of the incoming data.

Protobuf may or may not solve both of these issues, I've yet to look into protobuf enough to understand properly the correct usage in this scenario.

The networking implementation is also questionable, the way I see it. It feels fragile and far too complex, it needs cleaning and simplifying for others to be able to maintain.

Fernthedev avatar Nov 25 '21 19:11 Fernthedev