buttplugio / buttplug-js

Buttplug Typescript/Javascript Client Implementation
https://buttplug.io
BSD 3-Clause "New" or "Revised" License
128 stars 18 forks source link

Syntax Error on start/stop scanning calls #207

Closed qdot closed 5 years ago

qdot commented 5 years ago

Describe the bug

  1. go to https://playground.buttplug.world
  2. connect to intiface desktop server, so using json to communicate
  3. hit "start scanning"

Expected behavior Should start/stop scanning

Actual behavior Error on every other press:

SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data at line 1 column 32 of the JSON data
    FromJSON MessageUtils.js:30
    ParseIncomingMessage ButtplugBrowserWebsocketClientConnector.js:63
    Connect ButtplugBrowserWebsocketClientConnector.js:37
qdot commented 5 years ago

This is a problem with the C# server batching multiple JSON arrays into a single websocket packet, and JS's JSON.parse() can't deal with multiple json bodies in a string. Fixing this in C# at buttplugio/buttplug-csharp#645