falcor-http-ws-datasource
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -76,10 +76,2 @@ 'use strict'; | ||
var wsUrlPath = pushUrl.match(/ws+:\/\/.*?(\/.*)/); | ||
if (wsUrlPath && wsUrlPath[1]) { | ||
config.path = wsUrlPath[1] + "/socket.io"; | ||
} | ||
var socket = new _socketIoClient2['default'](pushUrl, config); | ||
if (!config.headers) { | ||
@@ -100,13 +92,26 @@ config.headers = {}; | ||
socket.emit('authorization', { bearerToken: config.bearerToken, tabId: sessionStorage.tabId }); | ||
var socket = null; | ||
if (pushUrl && pushUrl.length > 0) { | ||
var wsUrlPath = pushUrl.match(/ws+:\/\/.*?(\/.*)/); | ||
if (wsUrlPath && wsUrlPath[1]) { | ||
config.path = wsUrlPath[1] + "/socket.io"; | ||
} | ||
socket = new _socketIoClient2['default'](pushUrl, config); | ||
socket.emit('authorization', { bearerToken: config.bearerToken, tabId: sessionStorage.tabId }); | ||
} | ||
_get(Object.getPrototypeOf(FalcorHttpPullWebSocketPushDataSource.prototype), 'constructor', this).call(this, pullUrl, config); | ||
this.socket = socket; | ||
this.pushEvent = "falcor-push"; | ||
this.socket = socket; | ||
this.requestWatcher = new _delayedFunction2['default'](200); // Delay maxium between 2 falcor requests | ||
this.onError = config.onError || function () {}; | ||
} | ||
_createClass(FalcorHttpPullWebSocketPushDataSource, [{ | ||
key: 'onError', | ||
value: function onError() {} | ||
}, { | ||
key: 'onRequestStart', | ||
@@ -208,3 +213,3 @@ value: function onRequestStart() {} | ||
value: function onPushNotifications(callback) { | ||
if (callback) { | ||
if (callback && this.socket) { | ||
this.socket.on(this.pushEvent, function (data) { | ||
@@ -211,0 +216,0 @@ callback(data); |
{ | ||
"name": "falcor-http-ws-datasource", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "Falcor HTTP and WebSocket datasource", | ||
@@ -19,3 +19,3 @@ "homepage": "", | ||
"dependencies": { | ||
"@synhaptein/falcor-http-datasource": "^0.1.5", | ||
"@synhaptein/falcor-http-datasource": "^0.1.6", | ||
"socket.io-client": "^1.4.8", | ||
@@ -22,0 +22,0 @@ "uuid": "^2.0.1" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11851
220