ambient-weather / api-docs

AmbientWeather.net API Documentation
65 stars 43 forks source link

Socket.io connection reconnects every 2-3 minutes #8

Closed mhilbush closed 5 years ago

mhilbush commented 5 years ago

I'm implementing a service to integrate Ambient Weather into the openHAB home automation platform.

I've got it working pretty well, and I'm currently getting data events for my WS-1400-IP and the WS-8482.

However, every 3 minutes or so, I see a disconnect followed by a reconnect. I'm not sure what's causing this. To deal with it, I'm sending a subscribe command every time the reconnect happens. While not a major problem to do this, it does seem pretty inefficient.

I'm using the Java socket.io client software from here. https://github.com/socketio/socket.io-client-java

ambientweather commented 5 years ago

I will forward this to our programmer. Thanks ED

  From: Mark Hilbush <notifications@github.com>

To: ambient-weather/api-docs api-docs@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Sent: Tuesday, December 4, 2018 4:46 PM Subject: [ambient-weather/api-docs] Socket.io connection reconnects every 2-3 minutes (#8)

I'm implementing a service to integrate Ambient Weather into the openHAB home automation platform.I've got it working pretty well, and I'm currently getting data events for my WS-1400-IP and the WS-8482.However, every 3 minutes or so, I see a disconnect followed by a reconnect. I'm not sure what's causing this. To deal with it, I'm sending a subscribe command every time the reconnect happens. While not a major problem to do this, it does seem pretty inefficient.I'm using the Java socket.io client software from here. https://github.com/socketio/socket.io-client-java— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

mhilbush commented 5 years ago

Adding a little more info on what I'm seeing.

2018-12-06 17:46:23.706 [DEBUG] [.handler.AmbientWeatherEventListener] - EVENT_PING received
2018-12-06 17:46:23.790 [DEBUG] [.handler.AmbientWeatherEventListener] - EVENT_PONG received
2018-12-06 17:46:48.791 [DEBUG] [.handler.AmbientWeatherEventListener] - EVENT_PING received
2018-12-06 17:46:53.793 [DEBUG] [.handler.AmbientWeatherEventListener] - EVENT_DISCONNECT received
2018-12-06 17:47:05.295 [DEBUG] [.handler.AmbientWeatherEventListener] - EVENT_CONNECT_ERROR received
2018-12-06 17:47:08.365 [DEBUG] [.handler.AmbientWeatherEventListener] - EVENT_RECONNECT received
2018-12-06 17:47:08.372 [DEBUG] [.handler.AmbientWeatherEventListener] - EVENT_CONNECT received

If you need to see my code, it's here. https://github.com/mhilbush/openhab2-addons/blob/ambient-weather-binding/addons/binding/org.openhab.binding.ambientweather/src/main/java/org/openhab/binding/ambientweather/internal/handler/AmbientWeatherEventListener.java

owise1 commented 5 years ago

Thanks for letting us know. We're aware of this issue and working on it.

mhilbush commented 5 years ago

Thanks. I'm new to socket.io, and thought it might be something I was doing (or not doing).

owise1 commented 5 years ago

Hi @mhilbush , I'm not sure if you're still working on this project, but if you are, would you mind trying your socket connection using the domain "dash2.ambientweather.net" instead of "api.ambientweather.net" and let me know if the disconnects keep happening. We've been having load balancer issues and I'm experimenting with a workaround. If it's too much trouble no problem. thx.

mhilbush commented 5 years ago

Sure, I'll try it in a couple minutes and report back what I'm seeing.

mhilbush commented 5 years ago

@owise1 Been running for almost 25 minutes without a disconnect. I don't think I've ever gone more than 3 or 4 minutes, so your change is looking good from my end. I'll report back if I see any disconnects.

BTW, what time do you cycle your servers, so that I know what to expect if I see a disconnect at that time?

owise1 commented 5 years ago

Wonderful. Thanks for your help. Feel free to keep using that domain if you like. We're going to start transitioning things to it, so it'll stay up.

We actually don't cycle the servers any more unless it's necessary.

mhilbush commented 5 years ago

Ok, sounds good! Much appreciated.

mhilbush commented 5 years ago

Just wanted to close this out... No disconnects since 8 pm EST last night. I'll close this issue now.