I’m retrieving packets from a websocket. Every packet will have a cmd
member to designate what type of packet it is, but from there, each type of packet will contain different data, such as:
TextPacket {
text:String
}
ConnectionRefusedPacket {
errors:Array<String>
}
ItemsPacket {
locations:Array<Int>
}
What would be the best way for me to cast from the base packet type to the extended type to properly access whatever additional data that specific packet contains?
Please let me know if you need me to clarify anything, or need more information.