the client should use a protocol as well

This only handles messages recieved from the server, but it's a start.