@@ -275,6 +275,10 @@ keys:
275275- ` :protocols ` - an array of strings representing acceptable subprotocols for
276276 use over the socket. The driver will negotiate one of these to use via the
277277 ` Sec-WebSocket-Protocol ` header if supported by the other peer.
278+ - ` :binary_data_format ` - in older versions of this library, binary messages
279+ were represented as arrays of bytes, whereas they're now represented as
280+ strings with ` Encoding::BINARY ` for performance reasons. Set this option to
281+ ` :array ` to restore the old behaviour.
278282
279283All drivers respond to the following API methods, but some of them are no-ops
280284depending on whether the client supports the behaviour.
@@ -290,8 +294,8 @@ Adds a callback block to execute when the socket becomes open.
290294#### ` driver.on :message, -> (event) {} `
291295
292296Adds a callback block to execute when a message is received. ` event ` will have a
293- ` data ` attribute containing either a string in the case of a text message or an
294- array of integers in the case of a binary message.
297+ ` data ` attribute whose value is a string with the encoding ` Encoding::UTF_8 ` for
298+ text message, and ` Encoding::BINARY ` for binary message.
295299
296300#### ` driver.on :error, -> (event) {} `
297301
@@ -346,11 +350,12 @@ Sends a text message over the socket. If the socket handshake is not yet
346350complete, the message will be queued until it is. Returns ` true ` if the message
347351was sent or queued, and ` false ` if the socket can no longer send messages.
348352
349- #### ` driver.binary(array ) `
353+ #### ` driver.binary(buffer ) `
350354
351- Takes an array of byte-sized integers and sends them as a binary message. Will
352- queue and return ` true ` or ` false ` the same way as the ` text ` method. It will
353- also return ` false ` if the driver does not support binary messages.
355+ Takes either a string with encoding ` Encoding::BINARY ` , or an array of
356+ byte-sized integers, and sends it as a binary message. Will queue and return
357+ ` true ` or ` false ` the same way as the ` text ` method. It will also return ` false `
358+ if the driver does not support binary messages.
354359
355360#### ` driver.ping(string = '', &callback) `
356361
0 commit comments