hotwire-django / turbo-django

Unmaintained // An early stage integration of Hotwire Turbo with Django
https://discuss.hotwire.dev/t/django-backend-support-for-hotwire/1570/
Other
385 stars 20 forks source link

Bugfix/20 websocket not connecting #21

Closed JulianFeinauer closed 3 years ago

JulianFeinauer commented 3 years ago

Force a reconnect when the Tag is initialized.

(also added html / js files to setup.cfg)

C4ptainCrunch commented 3 years ago

From what i understand, reconnect() closes the socket and re-opens a new one. I think this not something desirable to do on every turbo drive visit, right ?

JulianFeinauer commented 3 years ago

From what i understand, reconnect() closes the socket and re-opens a new one. I think this not something desirable to do on every turbo drive visit, right ?

Indeed, you are right. This should probably be conditional on if it's already connected or something. That's just what made it work for me but I like to hear comments from the experts like @davish or @danjac!

blopker commented 3 years ago

Right, ideally we'd check if it's connected or now. However, we are using that reconnecting websocket library, why isn't that taking care of it? Something's fishy here.

JulianFeinauer commented 3 years ago

Right, ideally we'd check if it's connected or now. However, we are using that reconnecting websocket library, why isn't that taking care of it? Something's fishy here.

I guess that's some reconnect timeout limit hitting here OR it's already connected before the handlers are registered. So in this case they should go on and start without waiting for open, right?

blopker commented 3 years ago

I could help take a look at the issue if you have a minimal reproduction I could look at?

JulianFeinauer commented 3 years ago

I finally found a "elegant" solution (IMHO) and also discussed with @blopker. From my perspectigve this is fine now but some Tests wouldn't hurt, I guess.

But I have honestly no idea how to do that. Anyone else? @jonathan_s?

JulianFeinauer commented 3 years ago

Thanks and Agree!