From a7fb853d786cbb728f382c94a6a65667c59f06d0 Mon Sep 17 00:00:00 2001 From: Mike McNeil Date: Thu, 8 Dec 2016 17:25:31 -0600 Subject: [PATCH] Update links, add README to sails.io.js-dist, and clean up some TODOs that really ought to be FUTUREs (in the interest of reserving TODO for immediate things that need doing) --- README.md | 2 +- dist/README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ dist/package.json | 8 ++++---- dist/sails.io.js | 8 ++++---- sails.io.js | 15 ++++++++------- 5 files changed, 59 insertions(+), 16 deletions(-) create mode 100644 dist/README.md diff --git a/README.md b/README.md index 50446bd..cc03e43 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/dist/README.md b/dist/README.md new file mode 100644 index 0000000..5bd1c05 --- /dev/null +++ b/dist/README.md @@ -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   [![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   [![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) diff --git a/dist/package.json b/dist/package.json index 0b40fe1..45a84c6 100644 --- a/dist/package.json +++ b/dist/package.json @@ -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" } diff --git a/dist/sails.io.js b/dist/sails.io.js index ec89baf..a7902bd 100644 --- a/dist/sails.io.js +++ b/dist/sails.io.js @@ -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 @@ -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]; @@ -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]) { @@ -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')+'('+ diff --git a/sails.io.js b/sails.io.js index 53ef147..4fe732d 100644 --- a/sails.io.js +++ b/sails.io.js @@ -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 @@ -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(); } @@ -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.'); }; @@ -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]; @@ -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.) + }// @@ -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]) { @@ -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')+'('+