The WebSocket client library has only one method, SendText, to send data to server.
Is there any plan to support sending binary data (Byte array) such as binary file contents?
Is that even there in specification?
For now, I guess I should use ByteConverter and some sort of custom protocol?
The WebSocket client doesn't support binary transfers. If the file is small then you can encode it as base64 string. However for larger files it is recommended to use a standard http request. Otherwise you will block the single WebSocket connection.
There is such an example in B4J that combines WebSocket with a standard handler: http://basic4ppc.com:51042/ (file upload with websockets).
I tried with base64 encoding.
It worked for small files of ~8KB. But for ~50KB file, my connection disconnects.
I'm doing everything in may Main module but it continues to function. I do not get ANR.
What could be wrong?
I'm now trying to move some parts to a service.
OK, here is the reason specified in _Close event:
Frame size of 65975 bytes exceeds maximum accepted frame size
WebSockets connection lost
WebSockets internal error (java.nio.channels.ClosedChannelException)
OK, here is the reason specified in _Close event:
Frame size of 65975 bytes exceeds maximum accepted frame size
WebSockets connection lost
WebSockets internal error (java.nio.channels.ClosedChannelException)