Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does SailsService look for io connection and immediately close it #1

Closed
mryarbles opened this issue Sep 4, 2016 · 1 comment
Closed

Comments

@mryarbles
Copy link

When you include sails.io.js on page it automatically creates connection. Then when you import angular2-sails it immediately disconnects that previous connection. Why? What is the best way to instantiate the two?

if (io && io.sails) {
    if (io && io.socket && io.socket.isConnected) {
        io.socket.disconnect();
    }
}
@joeherold
Copy link
Owner

joeherold commented Sep 5, 2016

its because of the connection options you may pass in the initiation.
passing options: angular2-sails working with it

think of using different or changing connections than the local url of your sails app or creating a ios/android app. best way is to disable autoconnect in sails.io.js by passing this parameter or changing it in the template:
io.sails.autoConnect = false;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants