fix(core): update

This commit is contained in:
Philipp Kunz 2020-09-29 18:58:09 +00:00
parent 72196ec383
commit 1086065000
5 changed files with 18 additions and 21 deletions

6
package-lock.json generated
View File

@ -1560,9 +1560,9 @@
} }
}, },
"@pushrocks/smartenv": { "@pushrocks/smartenv": {
"version": "4.0.11", "version": "4.0.13",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartenv/-/smartenv-4.0.11.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartenv/-/smartenv-4.0.13.tgz",
"integrity": "sha512-dmphN7A3sUBdoBYbWdIYRvNEhvsZSZn/57tSMlpgqcyfGixYC8PGXKvqbsBKLnEwfpBFVQD95hHe26srANqELA==", "integrity": "sha512-6H9bBRrU8lKzIw2G+Cu6gUzIw2Gn/oYHY6gzxAzsozcUQG6tKKM5tU+A12FgVgOiVDDoki+h8LfDu2D85wqq8A==",
"requires": { "requires": {
"@pushrocks/smartparam": "^1.1.6", "@pushrocks/smartparam": "^1.1.6",
"@pushrocks/smartpromise": "^3.0.6", "@pushrocks/smartpromise": "^3.0.6",

View File

@ -24,7 +24,7 @@
"@pushrocks/isounique": "^1.0.4", "@pushrocks/isounique": "^1.0.4",
"@pushrocks/lik": "^4.0.17", "@pushrocks/lik": "^4.0.17",
"@pushrocks/smartdelay": "^2.0.10", "@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartenv": "^4.0.11", "@pushrocks/smartenv": "^4.0.13",
"@pushrocks/smartexpress": "^3.0.76", "@pushrocks/smartexpress": "^3.0.76",
"@pushrocks/smartlog": "^2.0.39", "@pushrocks/smartlog": "^2.0.39",
"@pushrocks/smartpromise": "^3.0.6", "@pushrocks/smartpromise": "^3.0.6",

View File

@ -64,8 +64,16 @@ export class SmartsocketClient {
/** /**
* connect the client to the server * connect the client to the server
*/ */
public connect() { public async connect() {
const done = plugins.smartpromise.defer(); const done = plugins.smartpromise.defer();
const smartenvInstance = new plugins.smartenv.Smartenv();
const socketIoClient = await smartenvInstance.getEnvAwareModule({
nodeModuleName: 'socket.io-client',
webUrlArg: 'https://cdn.jsdelivr.net/npm/socket.io-client@2/dist/socket.io.js',
getFunction: () => {
return globalThis.io;
}
});
logger.log('info', 'trying to connect...'); logger.log('info', 'trying to connect...');
const socketUrl = `${this.serverUrl}:${this.serverPort}`; const socketUrl = `${this.serverUrl}:${this.serverPort}`;
this.socketConnection = new SocketConnection({ this.socketConnection = new SocketConnection({
@ -74,7 +82,7 @@ export class SmartsocketClient {
role: this.socketRole, role: this.socketRole,
side: 'client', side: 'client',
smartsocketHost: this, smartsocketHost: this,
socket: plugins.socketIoClient(socketUrl, { socket: await socketIoClient.connect(socketUrl, {
multiplex: false, multiplex: false,
reconnectionAttempts: 5, reconnectionAttempts: 5,
}), }),

View File

@ -25,10 +25,3 @@ export {
smarttime, smarttime,
smartrx, smartrx,
}; };
// third party
import socketIoClient from 'socket.io-client';
export {
socketIoClient
};

View File

@ -2,19 +2,15 @@
import type http from 'http'; import type http from 'http';
import type https from 'https'; import type https from 'https';
export { export { http, https };
http,
https
};
// pushrocks scope // pushrocks scope
import type * as smartexpress from '@pushrocks/smartexpress'; import type * as smartexpress from '@pushrocks/smartexpress';
export { export { smartexpress };
smartexpress
};
// third party scope // third party scope
import type socketIo from 'socket.io'; import type socketIo from 'socket.io';
import type socketIoClient from 'socket.io-client';
export { socketIo }; export { socketIo, socketIoClient };