This PR changes the API of session.MakeWebsocketConnection so that the caller can type-switch on the message, rather than switching on the Evt field and decoding the JSON themselves.
I also tried to clean up the mapping from Evt to Go type via a bit of reflection, but I wasn't able to test it locally, so...fingers crossed it works at runtime. 😬
Thanks! This is really good. I knew there was a more elegant way to handle all the message types but didn't know enough about reflect to do it myself. I tested it and it worked perfectly. Merging :smile:
This PR changes the API of
session.MakeWebsocketConnection
so that the caller can type-switch on the message, rather than switching on theEvt
field and decoding the JSON themselves.I also tried to clean up the mapping from
Evt
to Go type via a bit of reflection, but I wasn't able to test it locally, so...fingers crossed it works at runtime. 😬