resolve-subscribe-socket.io
Advanced tools
Comparing version
@@ -7,5 +7,3 @@ import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
var createClientAdapter = function createClientAdapter(_ref) { | ||
var origin = _ref.origin, | ||
rootPath = _ref.rootPath, | ||
url = _ref.url, | ||
var url = _ref.url, | ||
onEvent = _ref.onEvent; | ||
@@ -33,4 +31,7 @@ var client; | ||
return new Promise(function (resolve, reject) { | ||
var protocolLength = 'https://'.length; | ||
var origin = url.substr(0, url.substr(protocolLength).indexOf('/') + protocolLength); | ||
var path = url.substr(url.substr(protocolLength).indexOf('/') + protocolLength); | ||
client = socketIOClient(origin, { | ||
path: "" + (rootPath ? "/" + rootPath : '') + url | ||
path: path | ||
}); | ||
@@ -37,0 +38,0 @@ client.on('connect', function () { |
@@ -17,5 +17,3 @@ "use strict"; | ||
var createClientAdapter = function createClientAdapter(_ref) { | ||
var origin = _ref.origin, | ||
rootPath = _ref.rootPath, | ||
url = _ref.url, | ||
var url = _ref.url, | ||
onEvent = _ref.onEvent; | ||
@@ -43,4 +41,7 @@ var client; | ||
return new Promise(function (resolve, reject) { | ||
var protocolLength = 'https://'.length; | ||
var origin = url.substr(0, url.substr(protocolLength).indexOf('/') + protocolLength); | ||
var path = url.substr(url.substr(protocolLength).indexOf('/') + protocolLength); | ||
client = (0, _socket.default)(origin, { | ||
path: "" + (rootPath ? "/" + rootPath : '') + url | ||
path: path | ||
}); | ||
@@ -47,0 +48,0 @@ client.on('connect', function () { |
{ | ||
"name": "resolve-subscribe-socket.io", | ||
"version": "0.18.7", | ||
"version": "0.18.8", | ||
"description": "This package serves as an adapter for resolve-redux subscribe to events.", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -8,3 +8,3 @@ import socketIOClient from 'socket.io-client' | ||
const createClientAdapter = ({ origin, rootPath, url, onEvent }) => { | ||
const createClientAdapter = ({ url, onEvent }) => { | ||
let client | ||
@@ -20,6 +20,13 @@ let isInitialized | ||
return await new Promise((resolve, reject) => { | ||
client = socketIOClient(origin, { | ||
path: `${rootPath ? `/${rootPath}` : ''}${url}` | ||
}) | ||
const protocolLength = 'https://'.length | ||
const origin = url.substr( | ||
0, | ||
url.substr(protocolLength).indexOf('/') + protocolLength | ||
) | ||
const path = url.substr( | ||
url.substr(protocolLength).indexOf('/') + protocolLength | ||
) | ||
client = socketIOClient(origin, { path }) | ||
client.on('connect', () => { | ||
@@ -26,0 +33,0 @@ isInitialized = true |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
26877
5.41%391
2.09%