Open anthozep opened 4 years ago
@anthozep Thanks for posting! We'll take a look as soon as possible.
In the mean time, there are a few ways you can help speed things along:
Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly.
For help with questions about Sails, click here.
Hi @anthozep Thanks for all the detailed info on this issue. Can you make us an empty Sails repo that reproduces this issue without any of the business logic?
Sure, this will take a bit of time, but I'm on it
Node version: 12.14.1 Sails version (sails): 1.2.4 ORM hook version (sails-hook-orm): 2.1.1 Sockets hook version (sails-hook-sockets): 2.0.0 Organics hook version (sails-hook-organics): N/A Grunt hook version (sails-hook-grunt): 3.1.0 Uploads hook version (sails-hook-uploads): N/A DB adapter & version (e.g. sails-mysql@5.55.5): sails-mysql@1.0.1 Skipper adapter & version (e.g. skipper-s3@5.55.5): N/A
Hi,
I have a sails.js application that uses websockets (sails.io) to communicate with a React application.
Most of the time, the socket fails to connect. The error in the React console on the frontend is:
I have implemented a simple beforeConnect in the backend that looks like this:
This should simply show the handshake and continue.
When the connection is successful, which is random and maybe happens 10% of the time, this works as expected and shows the handshake object. I then see that the frontend has connected in the console.
When it does not work, the beforeConnect function doesn't even seem to be called, so I'm not sure that the connection is even reaching the sails app. Since I set io.socket._raw.io._reconnection to true, it tries to reconnect, but again, the sails app doesn't seem to get the connection.
I should note that the same thing works both locally and in production on a cloud foundry service.
For more info, the front end code:
Backend: