node-json-socket icon indicating copy to clipboard operation
node-json-socket copied to clipboard

Parsing error

Open bifot opened this issue 5 years ago • 2 comments

When I'm sending a lot of messages to the server, some messages fail, other messages are ok.

{ success: false,
  error:
   'Error: Invalid content length supplied (\\",\\"payload\\":{\\"name\\":\\"StatTrak™ USP-S | Cortex (Factory New)\\",\\"patternIndex\\":230}},\\"meta\\":{\\"id\\":\\"32826924962616033\\",\\"host\\":\\"127.0.0.1\\",\\"port\\":51906}}16"}316) in: ' }
{ success: false,
  error:
   'Error: Invalid content length supplied (ective (Minimal Wear)\\",\\"patternIndex\\":954}},\\"meta\\":{\\"id\\":\\"5835899799671969\\",\\"host\\":\\"127.0.0.1\\",\\"port\\":51906}}17"}318) in: ' }

bifot avatar Jun 17 '19 12:06 bifot

Sometimes can't parse JSON.

{ success: false,
  error:
   'Error: Could not parse JSON: Unexpected number in JSON at position 320\nRequest data: {"success":false,"error":"Error: Could not parse JSON: Unexpected number in JSON at position 178\\nRequest data: {\\"data\\":{\\"action\\":\\"check\\",\\"payload\\":{\\"name\\":\\"StatTrak™ M4A4 | Royal Paladin (Factory New)\\",\\"patternIndex\\":959}},\\"meta\\":{\\"id\\":\\"32598132724562956\\",\\"host\\":\\"127.0.0.1\\",\\"port\\":51906}}18"}32' }

bifot avatar Jun 17 '19 12:06 bifot

@bifot what a delimeter-symbol have you use?

By default it is # - and if this occured in body messages - parsing is broken.

You can pass custom delimeter like this:

var serverSocket = new JsonSocket(socket, { delimeter: "⁂"});

foi avatar Jul 13 '19 00:07 foi