Some buttons do not work with ws >= 8.0.0
alexrudd2 opened this issue · comments
Here's the relevant code:
Lines 35 to 40 in b1996eb
By adding some logging statements, I found that the type of message
changed.
ws@8.13.0
received: {"c":"setPenHeight","p":{"height":13650,"rate":1000}}
type object
ws@7.5.9
received: {"c":"setPenHeight","p":{"height":13650,"rate":1000}}
type string
This was websockets/ws@e173423c
-
Text messages and close reasons are no longer decoded to strings. They are
passed asBuffer
s to the listeners of their respective events. The listeners
of the'message'
event now take a boolean argument specifying whether or not
the message is binary (e173423
).Existing code can be migrated by decoding the buffer explicitly.
websocket.on('message', function message(data, isBinary) { const message = isBinary ? data : data.toString(); // Continue as before. }); websocket.on('close', function close(code, data) { const reason = data.toString(); // Continue as before. });