crcastle / friends-from-the-trail-demo

Astro and his friends go camping and teach us the basics of Heroku
0 stars 0 forks source link

Sometimes selfie didn't show up in campfire scene #6

Closed crcastle closed 4 years ago

crcastle commented 4 years ago

I have a suspicion this is related to websocket connection timeout. Heroku HTTP (or websocket) connections timeout after a certain period of time with no data sent from either side. I recommend making a websocket ping request from the client every 25 seconds to mitigate this. See here for more info https://devcenter.heroku.com/articles/websockets#timeouts

Also, can can you confirm that the browser tries to reconnect the websocket connection if it dies, and if not add that? Conference internet connections can be flakey, and I wonder if intermittent connectivity issues might have cause this too.

mabotofu commented 4 years ago

@crcastle It currently tries to reconnect to the websocket every 1 second. I’ve seen this issue once and when it happened 404 was returned when the app tried to load the image user uploaded from the selfie app. When I checked the url, the image actually existed. So possibly, sometimes the image doesn’t get populated right away? I'll keep digging.

mabotofu commented 4 years ago

Ok so pinging and reconnecting are different. I will implement pinging.

mabotofu commented 4 years ago

@crcastle I confirm the client side tries to reconnect to the websocket connection if it dies. Also, I added code to ping the server every 25 seconds, however, there is not ping method so I'm just sending a message. What do you think? https://github.com/heroku/friends-from-the-trail-demo/pull/11/files#diff-2018087f584c4398b5c3a23fc0e5f9dbR18