sails: Sails client never connects if client opens when server is down (and then online).

Node version: 10.9 Sails version (sails):1.2.2 ORM hook version (sails-hook-orm): irrelevant Sockets hook version (sails-hook-sockets): unknown Organics hook version (sails-hook-organics): unknown Grunt hook version (sails-hook-grunt): unused Uploads hook version (sails-hook-uploads): unknown DB adapter & version (e.g. sails-mysql@5.55.5): irrelevant Skipper adapter & version (e.g. skipper-s3@5.55.5): unknown


The title pretty much says it all. If I open my web app when the server is down, and then turn the server on, sails client will never succeed to connect.

Meaning that io.socket.on('connect'... will never trigger.

Any idea why? Sounds like a bug to fix.

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 21 (7 by maintainers)

Most upvoted comments

Hey @glemiere! Thanks for the repo and the information. I’ll start looking into this as soon as I can, and I should have something for you by the end of my shift tomorrow.

@madisonhicks here you go: https://github.com/glemiere/repro-angular-sails-rt-bug

Let me know if you have any question.

The app component : https://github.com/glemiere/repro-angular-sails-rt-bug/blob/master/src/app/app.component.ts

The service communicating with sails: https://github.com/glemiere/repro-angular-sails-rt-bug/blob/master/src/app/services/api-call.service.ts

The env where you can change the API url: https://github.com/glemiere/repro-angular-sails-rt-bug/tree/master/src/environments

So you open the app with the SERVER DOWN. Then you turn the server ON And it won’t turn green with “service online”

Any other case works perfectly.

By default the app connects to localhost:1337.

PS: You need NodeJS v10.9+. I recommend using NVM for easy version switch.

Oh and thanks for the amazing work done with SailsJS. This framework is totally underrated, I love it! However it’d be nice to implement easier relationship query to avoid doing something like: https://gist.github.com/glemiere/426e2ada35a775d22a92819122798c5e

Also documentation needs a lot of improvement

@johnabrams7 Okay just got your text! Thanks for reaching out!

Hey @glemiere! - just sent you a text - the team is curious to chat with you further on this one. You can also reach Rachael on her twitter at: https://twitter.com/fancydoilies 👍

Hey, @glemiere. It seems like perhaps you want to enable io.sails.reconnection onthe Sails side of things? I created a repo of an empty Sails app, and a pull request setting io.sails.reconnection = true here. Is this helpful?

@madisonhicks doing this right now, sorry for late reply I’ve been busier than expected