For a deeper look into our Elektron API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
18 0 0 4

Why am I receiving a "JSON parser error" message from Elektron WebSocket?

I am receiving this error message about once per minute:

[{"ID":0,"Type":"Error","Text":"JSON parser error: -3","Debug":{"File":"Converter/jsonToRwfBase.C","Line":462,"Message":"08/16/2018 12:42:20"}}]

The only other messages I'm sending around this time is {"Type":"Ping"}, for which I receive a Pong,

or my response to the servers Ping, for which i send {"Type":"Pong"}.

Thanks in advance for any helpful ideas.

treprdp-apiwebsocketsrrto
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvote
Accepted
18 0 0 4

Finally discovered the source of the issue - I was using Websocket4net library https://github.com/kerryjiang/WebSocket4Net, and it's default configuration is to send a ping with timestamp every 60 seconds. If you are using this library, set EnableAutoSendPing to false.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
13k 32 12 18

Can you please provide additional details like RIC and language and particular example used when you get this error.

If connecting to a local TREP, we will need the ADS version as well.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
361 1 4 3

@james_molohon, Ensure you are sending a full and valid message. For example, a message like:

{"Type":"Ping" 

would produce this error since the closing bracket is missing.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
18 0 0 4

We are running version 2.6 on ADS. Our language is C#, and is similar to the sample code. Sorry ,but I am unable to share my code. I'm logging all messages sent and received. I see expected responses for the messages I send, but not sure why I continue to see this parser error with ID:0 at a one minute interval on every application that we use to connect to the websocket.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
361 1 4 3

I see that the error's Message field shows that the ADS appears to have received a frame containing only a date & time:

08/16/2018 12:42:20 

Looks like that was the current date & time. Is your application sending that over the WebSocket?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
18 0 0 4

I have a method that logs every message before sending over the websocket, and I don't see anything logged that resembles just the date and time. I have observed that we only receive the parser error message during periods when we are sending ping messages to keep the connection open, and not when we are fetching prices. But still I see the pings and pongs as noted in the original post, and the expected response from the websocket.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea