Websockets API - status_message AUTHORIZATION_REQUIRED

We currently have 10 Tempest stations installed. At each site we are running an application that obtains the data from the local tempest using the websockets API using a Personal Use Token. Everything works fine except, once-in-a-while, the data flow will stop with the message:

{“status_code”:5,“status_message”:"AUTHORIZATION_REQUIRED - Rate limit exceed or …

Note that we are using the same Personal Use Token (PUT) for all 10 sites. Is that why we get this message? Should we use a different PUT for each site?

Also, the “id” used in the “listen-start” message sent to the server is randomly generated each time. Should this be the same for each application?

Having struggled with a similar challenge, here’s a couple of things that I found:

  • if you have connection recovery logic, watch it closely (or watch your incoming message logs) to make sure you don’t have multiple, redundant connections open on each device. When debugging and reloading a client for example, if it doesn’t tear down the connection on the way out, you’ll easily get duplicate connections (sending duplicate messages to the same client). Or if your error handling re-opens a connection, watch it to make sure it’s not too aggressive.

  • if you have multiple clients all doing error handling and creating redundant connections, if you kill one of them, don’t rule out that the remaining clients aren’t going to leak connections and run you into the same problem…so kill all clients, wait 10 minutes for the connections server-side to close, and then try again.

  • the ‘id’ I use is unique to each connection, so I generate a random integer for each connection; initially I’d done a GUID/UUID for each device but that didn’t really matter/help in managing individual connections. I think this id should come back in the ws messages from the server as well so you can confirm that the messages coming in are for the same connection you had opened…but that’s just me talking.

Chris

2 Likes