-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Hi
There is a small bug in the tutorial (or in the code):
https://cettia.io/guides/cettia-tutorial/
The tutorial states
As the example suggests, event data can be basically anything as long as it is serializable, >regardless of whether data is binary or text. If at least one of the properties of the event data to >send is one of the following,
byte[] or ByteBuffer in the server.
Buffer (Node.js only), ArrayBuffer, or Typed Arrays in the client.
I just tried to send an ArrayBuffer with send() and Cettia-Javascript sends it as text message. The reason for that is that the check if there is binary data in the message does not work for ArrayBuffer objects.
https://github.com/cettia/cettia-javascript-client/blob/master/src/cettia.es6#L556-L562
ArrayBuffer.isView(value) returns false when the value is an ArrayBuffer.
It works when I wrap the ArrayBuffer for example in an Uint8Array, cettia-javascripts sends a binary message.