sacOO7 / socketcluster-client-go

GO client for socketcluster
https://socketcluster.io/
Apache License 2.0
55 stars 20 forks source link

Getting data before deserialization #7

Open kchaliki opened 6 years ago

kchaliki commented 6 years ago

Hello - would like to ask what you think about the following:

When registering a callback to receive messages, the library code will by default call utils.DeserializeDataFromString on the message and pass a map[string]interface{} to the callback.

If the client code wants to unmarshall the message directly to a struct it has serialize then deserialize again or do an awful lot of copying and casting. Do you think it makes sense to pass back bytes instead?

happilymarrieddad commented 5 years ago

Yea, I think it would be nice to have this. +1

sacOO7 commented 5 years ago

Yeah, it will probably look into it. But, i am sure you will need some mechanism to convert bytes to struct.. or a proper json struct model.