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

Socket.io transports for Android/iOS #308

Closed
Hurreman opened this issue Apr 10, 2013 · 6 comments
Closed

Socket.io transports for Android/iOS #308

Hurreman opened this issue Apr 10, 2013 · 6 comments

Comments

@Hurreman
Copy link

Is there a way to setup Socket.IO from a controller? I tried req.socket.set('transports' [...]) but without luck, and can't find anything in the wiki/docs.

Has anyone gotten mobile support for Socket.IO to work?

@mikermcneil
Copy link
Member

Hey Hurreman, thanks for bringing this up. The best thing to do is to call io.set('transports', [ /* ... */ ]); from your bootstrap function (config/bootstrap.js)

https://github.com/LearnBoost/Socket.IO/wiki/Configuring-Socket.IO#understanding-the-configure-method

That said, this is something that I'd like to see pulled into the core as a built-in configuration, just like we've done with all the Express options.

Hopefully, that helps for now. I'd love to see an example when you get this up and running!

@Hurreman
Copy link
Author

Hey Mike, I've given this a go but from what I can tell, io hasn't yet been declared when the bootstrap is called, resulting in an "io is not defined" exception. Am I missing something?

@mikermcneil
Copy link
Member

Nope you're right on target-- it's tricky because we want the bootstrap to fire before the server starts, so you can get all your app setup done first, but then we don't have io yet. I'll add a transports config for now

@mikermcneil
Copy link
Member

OK- I'm pushing support for sails.config.io.transports in a moment to master. You can use any of the existing config files, or create config/io.js to look like the following:

module.exports.io = {
  transports: [
    'websocket'
  , 'flashsocket'
  , 'htmlfile'
  , 'xhr-polling'
  , 'jsonp-polling'
  ]
};

@mikermcneil
Copy link
Member

Closed by 6d63c12

For now, to get it, you can install using:

npm install sails@git://github.com/balderdashy/sails.git#6d63c129c6fd2d5e0691c5231c0682594d11708f

@mikermcneil
Copy link
Member

PS- thanks for reminding me about this!

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

No branches or pull requests

2 participants