client/server event protocol
This is kind of a broad question, as I'm really not sure how to approach this problem.
I'm writing a game. I need to develop some sort of client-server event protocol. For example, the server might transmit an event to the client that contains the following information: timestamp, event type, source player uuid, target player uuid, and a variable (but specific to the event type) number of parameters.
I'm looking for a way to generate and parse these events that allows as much type safety as possible. I considered creating an enum of all my event types, and then putting code in switch statements (see here) to validate the number and type of the parameters and do something with the data. But gigantic switch statements are ugly, so I'm looking for a better design pattern.
The transport protocol doesn't matter... XML, binary, delimited plain text, whatever. I don't care as long as the event generation and parsing are easy.