I’ve stumbled upon an interesting issue concerning the reception of obs_st messages over the WebSocket API.
If one opens a second concurrent connection and issues listen_start for the same device ID, that connection will reply with an ack along with an initial obs_st message ("source":"cache"), but no further messages. Meanwhile, the first connection will receive all of the messages.
Disconnecting the first connection does not seem to unblock the second one.
In contrast, rapid_wind messages (from listen_rapid_start) appear to be broadcast to all connections.
Is this behavior expected? If so, it would be nice if the API would expose the error rather than being silent about it.
I’m aware that “A client should only open one websocket connection” (from the API docs) – my use case unfortunately requires two connections for two realtime displays in independent locations, and I’d prefer not to insert my own MQTT server as a point of failure. I’m hoping that this behavior is an oversight, and that there’s a tiny bit of slack on the “one connection” policy…
Unfortunately this behaviour has been occurring for a while. I don’t think it is to do with the “A client should only open one websocket connection” policy, but rather an issue with the Websocket itself. I am going to loop in @corrineb who might be able to shed more light
I’m interested to find this. After having used UDP for a while, I decided last friday to dive into the websockets and observed the exact same behavior. Rapid Wind comes in every 3 seconds. Obs_st only comes in once and then never again. Figured I’d come back to it later only to find this. Guess it’s not just me.
Thanks for the reports @tris and @mabeatty1978 and for the tag @peter. @mabeatty1978 I will have the team test things using your account info and let you know what we find. @tris I looked up your account info, but it doesn’t look like you have devices attached to your account. Feel free to dm me the email address of the account you are working with and I can take a closer look.
Thanks for looking into this. The behaviour @tris describes has been a bit of a persistent issue for a while. I had to implement a connection watchdog in the PiConsole to reset the Websocket if this condition occurred, or else users kept reporting that the display was offline and not receiving new observations (except rapid_wind). I can reliably recreate the issue by opening two Websocket connections on two separate clients using the same internet connection
@corrineb—I’m seeing the same issue. I’m testing multiple versions of an application using a Web socket, and all of my data goes silent for some unexplainable reason.
I send a request to all of my devices and get an ACK, but sometimes, I get nothing back from the Websocket. Pings/Pongs work, but there is no data. Sometimes, the socket disconnects. I reconnect, but the data is not available after I get ACKs. If it makes sense to open a new request, I will do so.
In most situations I get a steady stream of OBS and Wind data from my 10 devices without issue… Nothing is changing on my side.
I get an ACK back as I’ve done forever, and today I’ve been getting socket disconnects, connections with ACKs back, and no data, and then other times, it’s working 100% of the time.
I’ll see if it resolves itself and build more health checks into the system. Thanks!
Oh - you meant ‘for’ your devices. Sure. But you need to program defensively in any event as always. What you’re running into is kinda why I always worked just off the local hub UDP broadcasts since that takes anything Internet or WF-server out of the equation, but you do lose a little bit in the data you can get of course per the APIs…
I’m capturing a dozen remote devices now with plans for hundreds. While I love UDP - placing resources at every remote site isn’t viable. This has been working for years - only in the last 5 days or so has the WebSocket connection been unstable from the WeatherFlow side. When connected, it stops sending data. I’ve built a health check to restart the connection if no data is received. (I can still see ping/pong - so the connection is responsive… just no JSON is flowing)
I can have as much resilience on my side, but there’s a failure on the WeatherFlow side, and I’m trying to determine if it’s widespread or specific to me. It’s been solid for as long as I can remember.
This has just begun to happen for me on my Weewx box. Websocket is connected, ping/pongs are responsive so the connection is remaining open, but all data just stops flowing until the Websocket connection is stopped and restarted.
This can’t be a widespread issue otherwise everyone running the piconsole would see it at the same time. It must be isolated to specific users or specific personal access tokens. Have you seen an improvement over time?