Add a `fromJson` option to onMessage

This unserializes the message from the websocket to pass to the
callback.