Hi,
We are using Protocol Buffers for serialization and sending messages. However I can't find a way to send raw byte arrays with SmartFoxServer.
SFSObject is terrible and error prone. I prefer to keep serialization automatic to avoid bugs.
How can I send raw byte array?
Sending byte arrays
-
- Posts: 7
- Joined: 19 Jan 2019, 15:53
Re: Sending byte arrays
Hi,
SmartFoxServer 2X has uses its own codec/protocol serializer which cannot be bypassed. If you want to send raw bytes you can wrap them into an SFSObject via the put/getByteArray() methods
If you have specific bug reports regarding SFSObject let us know the details.
As regards the "terrible" qualifier, I have no idea how to respond to that It would probably help if you could at least explain the specific reason for your opinion and provide suggestions for improvements.
Cheers
SmartFoxServer 2X has uses its own codec/protocol serializer which cannot be bypassed. If you want to send raw bytes you can wrap them into an SFSObject via the put/getByteArray() methods
sorencoder wrote:SFSObject is terrible and error prone.
If you have specific bug reports regarding SFSObject let us know the details.
As regards the "terrible" qualifier, I have no idea how to respond to that It would probably help if you could at least explain the specific reason for your opinion and provide suggestions for improvements.
Cheers
-
- Posts: 7
- Joined: 19 Jan 2019, 15:53
Re: Sending byte arrays
First, Thank you for your response. I'll wrap byte arrays.
SFSObject problems:
First It's text-based. It means that we don't get intellisense or auto-completion. A simple typo in one of keys can lead to hard to catch bugs. We are using protobuf and it doesn't have this problem.
Second it's manual. You have to serialize and deserialize fields by hand. It's easy to forget to deserialize a newly added field in a complex class...
Third, Given that we use different languages for server and client, (Client is C# and Server is Java), We have to write Serialization and Deserialization twice! With previous two problems (being text-based and manual), It easily becomes a disaster.
Protobuf automatically generates model classes for both languages (Java and C#) and automatically serializes them. That's why we insist on using that.
It would be very helpful if you add support for 3rd-party serialization protocols.
Best Regards!
SFSObject problems:
First It's text-based. It means that we don't get intellisense or auto-completion. A simple typo in one of keys can lead to hard to catch bugs. We are using protobuf and it doesn't have this problem.
Second it's manual. You have to serialize and deserialize fields by hand. It's easy to forget to deserialize a newly added field in a complex class...
Third, Given that we use different languages for server and client, (Client is C# and Server is Java), We have to write Serialization and Deserialization twice! With previous two problems (being text-based and manual), It easily becomes a disaster.
Protobuf automatically generates model classes for both languages (Java and C#) and automatically serializes them. That's why we insist on using that.
It would be very helpful if you add support for 3rd-party serialization protocols.
Best Regards!
Re: Sending byte arrays
It would be very helpful if you add support for 3rd-party serialization protocols.
As mentioned before, you can plug in your own custom binary serialization and wrap the raw data into a byte array.
Cheers
Who is online
Users browsing this forum: cvmouro and 103 guests