I have a go program using the (relatively) standard go.net/websocket library. I am trying to receive and decode messages from a web page that have a different structure for each type of message, i.e.
{type: "messagetype", msg: { } }
Is there a way to do a βpartialβ decoding of a message only by checking the type field before proceeding to decrypt the actual message in go struct?
Does this require writing a custom Codec , a'la JSON , which delegates the JSON codec to the message itself?
source share