Skip to content

Network Protocol #3

@DavidLoftus

Description

@DavidLoftus

Since we decided to prioritise backend for now we should probably flesh out the ideas for the protocol. Currently our test code simply sends lines back and forth from client to server as raw text, but its clear this won't work for anything more complicated. We are going to need a message structure to serialise data into components.

Our first decision is whether to use an text based or binary message structure. A text based approach like JSON would mean our protocol is easy to debug, test and monitor. A binary approach means our protocol would be compact and we gain some "Security through Obscurity" but it is alot harder to maintain. Discord uses JSON for all it's network code afaik.

I think it's important we avoid writing our own serialization code, this would just add yet another piece of code to maintain, instead we should use fleshed out libraries like gson or protoBuf (both by google). Using these libraries would also mean it is easier to port the code to other languages.

As for the messages themselves, I've begun writing down the core messages we need (of course we can continue to add more to the list as we see fit).

  • Authenticate (Client -> Server): Connects to server as specified user, for now we shouldn't have any password authentication until we sort out encryption so it will just check that no user with that name is already logged in.
  • Message Create (Client <-> Server): Client must be authenticated to send this message. Should specify message content, room/channel name. This message will probably have to differ between (Client -> Server) and (Server -> Client).
  • Logout (Client -> Server): Gracefully disconnects

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions