stefandreyer / CODESYS-MQTT

MQTT client library for CODESYS, supporting all QoS
MIT License
109 stars 24 forks source link

Unexpected character in TLS #61

Open SanderNID opened 1 year ago

SanderNID commented 1 year ago

Hi,

I get sometimes errors that the payload is not a json fromat. When I turn TLS off this problem does not occur, however when TLS is enabled we get these errors sometimes.

Any clue?

• 2022-12-07T15:00:26.599Z: Unexpected character ('笢' (code 31522 / 0x7b22)): was expecting double-quote to start field name at [Source: (byte[])"\u0000{{"name":"GPS","ts":1670425161

• 2022-12-07T15:33:46.48Z: Unrecognized token 'ï뾽笢湡浥': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false') at [Source: (byte[])"\u0000�{"name":"GPS","ts":1670427161

• 2022-12-07T16:07:06.475Z: Illegal character ((CTRL-CHAR, code 1)): only regular white space (\r, \n, \t) is allowed between tokens at [Source: (byte[])"\u0001�{"name":"GPS","ts":1670429161

• 2022-12-07T16:40:26.475Z: Illegal character ((CTRL-CHAR, code 2)): only regular white space (\r, \n, \t) is allowed between tokens at [Source: (byte[])"\u0002\u0007{"name":"GPS","ts":1670431161

• 2022-12-07T17:13:46.484Z: Illegal character ((CTRL-CHAR, code 2)): only regular white space (\r, \n, \t) is allowed between tokens at [Source: (byte[])"\u0002�{"name":"GPS","ts":1670433161

Best regards, Sander

stefandreyer commented 1 year ago

Hi Sander,

Puh, do you have any possibility to Monitor your telegrams? Maybe you make a second connection to another broker without TLS to verify the content?

Is the Unexpected char always at the same possition?

Do you use the latest lib? There was a problem calculating the remaining length(but should be indepenten for TLS/ no TLS).

Else you may use a pumkin Pi to look in the pakets(I never tried this).

BR Stefan