You are not logged in.
Pages: 1
Hi,
Modifying the Project31ChatServer example, I compress some json records with Zlib for compatibility and then call "NotifyBlaBla(pseudo,msg)" where msg is the compressed json.
Once compressed I take volume size to compare with the size received.
What happens is that the client receive fewer bytes than the server sends.
I have no idea how to solve it or because it happens.
Thanks in advance for any help.
Offline
Hi ab,
Then, how can I send this?
Offline
If you use text transmission, the only possibility is to base-64 encode the compressed content.
You need to use a binary transmission with your WebSockets, like for the TWebSocketProtocolBinary, instead of the TWebSocketProtocolChat protocol, which is text-based.
BTW, TWebSocketProtocolBinary has already built-in compression and encryption available.
Why do you want to reinvent the wheel?
Offline
Why do you want to reinvent the wheel?
Because I don't know which programming language will use on client-side
Offline
So, keep with JSON and text protocol, without compression.
It will be safe and easy enough to work with, for any client-side client.
Cross-platform compression is very difficult to implement.
The only possible way may be to implement https://tools.ietf.org/html/rfc7692 but even this is a proposed standard, not widely adopted I'm afraid...
Offline
I can't keep it without compression because the json size is about 150k.
Is there another way to send this binary data?
I only need to send this data from server to clients.
Last edited by jars (2016-10-24 14:59:09)
Offline
Long polling may be easier to implement.
But it will depend also on the clients possibilities/technologies used.
But of course, WebSockets binary could be used for that.
Just create your own server side protocol class, taking inspiration from TWebSocketProtocolBinary and TWebSocketProtocolChat.
Offline
Pages: 1