Skip to content

Commit

Permalink
Moved note about io.sails to the top of the advanced usage section
Browse files Browse the repository at this point in the history
  • Loading branch information
sgress454 committed Jan 18, 2016
1 parent 13d21b8 commit 4492315
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ $ bower install sails.io.js

#### Advanced Usage


The `io.sails` config functions as the default for all connected sockets, allowing you to change client behavior globally. It can be overridden on a socket-by-socket basis by passing in an object to `io.sails.connect(opts)`


###### Cross-domain

Connect to a server other than the one that served ths project (i.e. on a different domain/subdomain):
Expand Down Expand Up @@ -146,8 +150,6 @@ io.socket.post("/foo", someData, someCallback);
</script>
```

> Note that the `io.sails` config functions as the default for all connected sockets, but it can be overridden on a socket-by-socket basis by passing in an object to `io.sails.connect(opts)`
###### Change the `transports` used to connect to the server

In some cases you may want to change the transorts that the socket client uses to connect to the server, and vice versa. For instance, some server environments--*notably Heroku*--do not support "sticky load balancing", causing the "polling" transport to fail. In these cases, you should first [change the transports listed in the `config/sockets.js` file](http://sailsjs.org/#/documentation/reference/sails.config/sails.config.sockets.html?q=advanced-configuration) in your Sails app. Then change the transports in the client by setting `io.sails.transports`:
Expand All @@ -159,7 +161,6 @@ In some cases you may want to change the transorts that the socket client uses t
</script>
```


#### RequireJS/AMD Usage

To use this in an AMD environment, *use the sails.io.js in the root* of this repo, not in dist. The dist build bundles a version of the socket.io client which will cause errors when trying to load two anonymous AMD modules from the same file. The file in root is not bundled with socket.io
Expand Down

0 comments on commit 4492315

Please sign in to comment.