Actually releasing 1.1.3

This commit is contained in:
Andrew Godwin 2017-04-07 04:35:37 +01:00
parent 64e0470b76
commit 5f7e76141c
3 changed files with 23 additions and 19 deletions

View File

@ -1,4 +1,4 @@
__version__ = "1.1.2" __version__ = "1.1.3"
default_app_config = 'channels.apps.ChannelsConfig' default_app_config = 'channels.apps.ChannelsConfig'
DEFAULT_CHANNEL_LAYER = 'default' DEFAULT_CHANNEL_LAYER = 'default'

View File

@ -17,8 +17,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var noop = function noop() {};
/** /**
* Bridge between Channels and plain javascript. * Bridge between Channels and plain javascript.
* *
@ -29,17 +27,19 @@ var noop = function noop() {};
* console.log(action, stream); * console.log(action, stream);
* }); * });
*/ */
var WebSocketBridge = function () { var WebSocketBridge = function () {
function WebSocketBridge(options) { function WebSocketBridge(options) {
_classCallCheck(this, WebSocketBridge); _classCallCheck(this, WebSocketBridge);
this._socket = null; /**
* The underlaying `ReconnectingWebSocket` instance.
*
* @type {ReconnectingWebSocket}
*/
this.socket = null;
this.streams = {}; this.streams = {};
this.default_cb = null; this.default_cb = null;
this.options = _extends({}, { this.options = _extends({}, options);
onopen: noop
}, options);
} }
/** /**
@ -59,14 +59,20 @@ var WebSocketBridge = function () {
key: 'connect', key: 'connect',
value: function connect(url, protocols, options) { value: function connect(url, protocols, options) {
var _url = void 0; var _url = void 0;
// Use wss:// if running on https://
var scheme = window.location.protocol === 'https:' ? 'wss' : 'ws';
var base_url = scheme + '://' + window.location.host;
if (url === undefined) { if (url === undefined) {
// Use wss:// if running on https:// _url = base_url;
var scheme = window.location.protocol === 'https:' ? 'wss' : 'ws';
_url = scheme + '://' + window.location.host + '/ws';
} else { } else {
_url = url; // Support relative URLs
if (url[0] == '/') {
_url = '' + base_url + url;
} else {
_url = url;
}
} }
this._socket = new _reconnectingWebsocket2.default(_url, protocols, options); this.socket = new _reconnectingWebsocket2.default(_url, protocols, options);
} }
/** /**
@ -89,7 +95,7 @@ var WebSocketBridge = function () {
var _this = this; var _this = this;
this.default_cb = cb; this.default_cb = cb;
this._socket.onmessage = function (event) { this.socket.onmessage = function (event) {
var msg = JSON.parse(event.data); var msg = JSON.parse(event.data);
var action = void 0; var action = void 0;
var stream = void 0; var stream = void 0;
@ -105,8 +111,6 @@ var WebSocketBridge = function () {
_this.default_cb ? _this.default_cb(action, stream) : null; _this.default_cb ? _this.default_cb(action, stream) : null;
} }
}; };
this._socket.onopen = this.options.onopen;
} }
/** /**
@ -146,7 +150,7 @@ var WebSocketBridge = function () {
}, { }, {
key: 'send', key: 'send',
value: function send(msg) { value: function send(msg) {
this._socket.send(JSON.stringify(msg)); this.socket.send(JSON.stringify(msg));
} }
/** /**
@ -169,7 +173,7 @@ var WebSocketBridge = function () {
stream: _stream, stream: _stream,
payload: action payload: action
}; };
_this2._socket.send(JSON.stringify(msg)); _this2.socket.send(JSON.stringify(msg));
} }
}; };
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "django-channels", "name": "django-channels",
"version": "1.1.2", "version": "1.1.3",
"description": "", "description": "",
"repository": { "repository": {
"type": "git", "type": "git",