Skip to content

Commit

Permalink
Update links, add README to sails.io.js-dist, and clean up some TODOs…
Browse files Browse the repository at this point in the history
… that really ought to be FUTUREs (in the interest of reserving TODO for immediate things that need doing)
  • Loading branch information
mikermcneil committed Dec 8, 2016
1 parent 485f3cd commit a7fb853
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ io.socket.post("/foo", someData, someCallback);

###### 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`:
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.com/documentation/reference/sails-config/sails-config-sockets#?advanced-configuration) in your Sails app. Then change the transports in the client by setting `io.sails.transports`:

```html
<script type="text/javascript" src="/dependencies/sails.io.js"></script>
Expand Down
42 changes: 42 additions & 0 deletions dist/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# sails.io.js-dist

This is the JavaScript SDK for communicating with Sails via sockets. Specifically, it is the distribution for web browsers, and the release that is bundled in new Sails apps by default.


## Compatibility

Before using this package directly, be sure that you're using the same version as the dependency in your version of Sails's [sails-generate](https://npmjs.com/package/sails-generate)'s package.json file.

> Prior to Sails v1, instead of `sails-generate`, this was in the `sails-generate-sails.io.js` dependency,
> which was itself a dependency of `sails-generate-frontend`, which was itself a depenency of `sails-generate`,
> which was itself a dependency of `sails. (You can see why we changed it!)
>
> Anyway, if you're using <=Sails v0.12, check the dependency version in the package.json file of [sails-generate-sails.io.js](https://npmjs.com/package/sails-generate-sails.io.js).

This package is _always_ released under the same version string as [`sails.io.js`](https://npmjs.com/package/sails.io.js), the Node.js distribution. (It is published automatically when `sails.io.js` is published.)


## Help

If you have questions or are having trouble, click [here](http://sailsjs.com/support).


## Bugs &nbsp; [![NPM version](https://badge.fury.io/js/sails.io.js-dist.svg)](http://npmjs.com/package/sails.io.js-dist)

To report a bug, [click here](http://sailsjs.com/bugs).


## Contributing &nbsp; [![Build Status](https://travis-ci.org/balderdashy/sails.io.js-dist.svg?branch=master)](https://travis-ci.org/balderdashy/sails.io.js-dist)

Please observe the guidelines and conventions laid out in the [Sails project contribution guide](http://sailsjs.com/contribute) when opening issues or submitting pull requests.

[![NPM](https://nodei.co/npm/sails.io.js-dist.png?downloads=true)](http://npmjs.com/package/sails.io.js-dist)


## License

This package is part of the [Sails framework](http://sailsjs.com), and is free and open-source under the [MIT License](http://sailsjs.com/license).


![image_squidhome@2x.png](http://i.imgur.com/RIvu9.png)
8 changes: 4 additions & 4 deletions dist/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "sails.io.js-dist",
"version": "1.1.0",
"description": "Distribution version of sails.io.js for browsers, including bundled socket.io-client",
"description": "Distribution version of sails.io.js for browsers, including bundled socket.io-client.",
"main": "sails.io.js",
"repository": {
"type": "git",
"url": "git://github.com/balderdashy/sails.io.js.git"
},
"author": "Mike McNeil <@mikermcneil> (http://balderdash.co/)",
"author": "Mike McNeil <@mikermcneil> (http://mikermcneil.com/)",
"license": "MIT",
"bugs": {
"url": "https://github.com/balderdashy/sails.io.js/issues"
"url": "https://github.com/balderdashy/sails/issues"
},
"homepage": "https://github.com/balderdashy/sails.io.js"
"homepage": "http://sailsjs.com/documentation/reference/web-sockets/socket-client"
}
8 changes: 4 additions & 4 deletions dist/sails.io.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pong:3,message:4,upgrade:5,noop:6},s=i(r),t={type:"error",data:"parser error"},u
* using WebSockets from the browser to talk to your Sails server.
*
* For tips and documentation, visit:
* http://sailsjs.org/#!documentation/reference/BrowserSDK/BrowserSDK.html
* http://sailsjs.com/documentation/reference/web-sockets/socket-client
* ------------------------------------------------------------------------
*
* This file allows you to send and receive socket.io messages to & from Sails
Expand Down Expand Up @@ -702,7 +702,7 @@ pong:3,message:4,upgrade:5,noop:6},s=i(r),t={type:"error",data:"parser error"},u
});

// Absorb opts into SailsSocket instance
// See https://sailsjs.org/reference/websockets/sails.io.js/SailsSocket/properties.md
// See http://sailsjs.com/documentation/reference/web-sockets/socket-client/sails-socket/properties
// for description of options
SOCKET_OPTIONS.forEach(function(option) {
self[option] = opts[option];
Expand Down Expand Up @@ -742,7 +742,7 @@ pong:3,message:4,upgrade:5,noop:6},s=i(r),t={type:"error",data:"parser error"},u

// Apply `io.sails` config as defaults
// (now that at least one tick has elapsed)
// See https://sailsjs.org/reference/websockets/sails.io.js/SailsSocket/properties.md
// See http://sailsjs.com/documentation/reference/web-sockets/socket-client/sails-socket/properties
// for description of options and default values
SOCKET_OPTIONS.forEach(function(option) {
if ('undefined' == typeof self[option]) {
Expand Down Expand Up @@ -1265,7 +1265,7 @@ pong:3,message:4,upgrade:5,noop:6},s=i(r),t={type:"error",data:"parser error"},u
'socket.request( options, [fnToCallWhenComplete] )\n\n'+
'options.url :: e.g. "/foo/bar"'+'\n'+
'options.method :: e.g. "get", "post", "put", or "delete", etc.'+'\n'+
'options.params :: e.g. { emailAddress: "mike@sailsjs.org" }'+'\n'+
'options.params :: e.g. { emailAddress: "mike@example.com" }'+'\n'+
'options.headers :: e.g. { "x-my-custom-header": "some string" }';
// Old usage:
// var usage = 'Usage:\n socket.'+(options.method||'request')+'('+
Expand Down
15 changes: 8 additions & 7 deletions sails.io.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* using WebSockets from the browser to talk to your Sails server.
*
* For tips and documentation, visit:
* http://sailsjs.org/#!documentation/reference/BrowserSDK/BrowserSDK.html
* http://sailsjs.com/documentation/reference/web-sockets/socket-client
* ------------------------------------------------------------------------
*
* This file allows you to send and receive socket.io messages to & from Sails
Expand Down Expand Up @@ -478,7 +478,7 @@
opts = opts || {};

if (typeof window === 'undefined') {
// TODO: refactor node usage to live in here
// FUTURE: refactor node usage to live in here
return cb();
}

Expand Down Expand Up @@ -567,7 +567,7 @@
};
};
JWR.prototype.pipe = function() {
// TODO: look at substack's stuff
// FUTURE: look at substack's stuff
return new Error('Client-side streaming support not implemented yet.');
};

Expand Down Expand Up @@ -684,7 +684,7 @@
});

// Absorb opts into SailsSocket instance
// See https://sailsjs.org/reference/websockets/sails.io.js/SailsSocket/properties.md
// See http://sailsjs.com/documentation/reference/web-sockets/socket-client/sails-socket/properties
// for description of options
SOCKET_OPTIONS.forEach(function(option) {
self[option] = opts[option];
Expand All @@ -701,12 +701,13 @@
consolog('Error details:',err);
});

// TODO:
// FUTURE:
// Listen for a special private message on any connected that allows the server
// to set the environment (giving us 100% certainty that we guessed right)
// However, note that the `console.log`s called before and after connection
// are still forced to rely on our existing heuristics (to disable, tack #production
// onto the URL used to fetch this file.)

}//</SailsSocket>


Expand All @@ -724,7 +725,7 @@

// Apply `io.sails` config as defaults
// (now that at least one tick has elapsed)
// See https://sailsjs.org/reference/websockets/sails.io.js/SailsSocket/properties.md
// See http://sailsjs.com/documentation/reference/web-sockets/socket-client/sails-socket/properties
// for description of options and default values
SOCKET_OPTIONS.forEach(function(option) {
if ('undefined' == typeof self[option]) {
Expand Down Expand Up @@ -1247,7 +1248,7 @@
'socket.request( options, [fnToCallWhenComplete] )\n\n'+
'options.url :: e.g. "/foo/bar"'+'\n'+
'options.method :: e.g. "get", "post", "put", or "delete", etc.'+'\n'+
'options.params :: e.g. { emailAddress: "mike@sailsjs.org" }'+'\n'+
'options.params :: e.g. { emailAddress: "mike@example.com" }'+'\n'+
'options.headers :: e.g. { "x-my-custom-header": "some string" }';
// Old usage:
// var usage = 'Usage:\n socket.'+(options.method||'request')+'('+
Expand Down

0 comments on commit a7fb853

Please sign in to comment.