Typed events, phase one: the client.
Typed events, phase two: the server.
Make everything work together.