janpantel / angular-sails

An angular module for using the sails socket.io api
MIT License
307 stars 56 forks source link

Wrong default transports config? #83

Closed ziacik closed 9 years ago

ziacik commented 9 years ago

Hi. In default config for angular-sails provider, there are transports set like this

transports: ['websocket', 'polling']

I believe it shoud be like this

transports: ['polling', 'websocket']

so that at first polling is tried and only after that probing for websocket upgrade starts. If websockets are configured first and they are blocked by proxy, io will never fallback to polling. I have worked this around by setting the transports explicitly in provider config.

Also, I think that sails.io tries to connect to socket at app startup and it does some kind of connection caching thus making angular-sails transport config ineffective.

TheSharpieOne commented 9 years ago

Can you create a PR to switch the order of the transports.

Also, angular-sails tells sails.io to not auto connect, and only initializes the connection when the $sails service is invoked. This allows for angular-sails to pass the configs to sails.io