Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
9eac5ad336 | |||
cf607a79d5 | |||
8426c976bf | |||
1086065000 |
13
package-lock.json
generated
13
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartsocket",
|
||||
"version": "1.1.62",
|
||||
"version": "1.1.64",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -1560,11 +1560,10 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartenv": {
|
||||
"version": "4.0.11",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartenv/-/smartenv-4.0.11.tgz",
|
||||
"integrity": "sha512-dmphN7A3sUBdoBYbWdIYRvNEhvsZSZn/57tSMlpgqcyfGixYC8PGXKvqbsBKLnEwfpBFVQD95hHe26srANqELA==",
|
||||
"version": "4.0.15",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartenv/-/smartenv-4.0.15.tgz",
|
||||
"integrity": "sha512-7bz2jzxAnojlIu3jYCZwnG5LEIjAQbLEQFRLpWDzoS80U62kEhC8bhOJ7+pdMHH3xqDYszabiv2PEr5/zQZ/Nw==",
|
||||
"requires": {
|
||||
"@pushrocks/smartparam": "^1.1.6",
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"@types/node": "^14.11.2"
|
||||
}
|
||||
@ -1889,6 +1888,7 @@
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartparam/-/smartparam-1.1.6.tgz",
|
||||
"integrity": "sha512-1El/F2QTWYDGy4Nh6vz9Ry1JVg1FEeyexB7Uvi4zHElpXYVxwso6xImRTLj+SW50JAg7nwEZ+ljkzTG9XvnwWA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"is-promise": "^2.1.0",
|
||||
@ -6855,7 +6855,8 @@
|
||||
"is-promise": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://verdaccio.lossless.one/is-promise/-/is-promise-2.2.2.tgz",
|
||||
"integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ=="
|
||||
"integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==",
|
||||
"dev": true
|
||||
},
|
||||
"is-reference": {
|
||||
"version": "1.2.1",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartsocket",
|
||||
"version": "1.1.62",
|
||||
"version": "1.1.64",
|
||||
"description": "easy and secure websocket communication",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
@ -24,7 +24,7 @@
|
||||
"@pushrocks/isounique": "^1.0.4",
|
||||
"@pushrocks/lik": "^4.0.17",
|
||||
"@pushrocks/smartdelay": "^2.0.10",
|
||||
"@pushrocks/smartenv": "^4.0.11",
|
||||
"@pushrocks/smartenv": "^4.0.15",
|
||||
"@pushrocks/smartexpress": "^3.0.76",
|
||||
"@pushrocks/smartlog": "^2.0.39",
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
|
@ -64,8 +64,16 @@ export class SmartsocketClient {
|
||||
/**
|
||||
* connect the client to the server
|
||||
*/
|
||||
public connect() {
|
||||
public async connect() {
|
||||
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...');
|
||||
const socketUrl = `${this.serverUrl}:${this.serverPort}`;
|
||||
this.socketConnection = new SocketConnection({
|
||||
@ -74,7 +82,7 @@ export class SmartsocketClient {
|
||||
role: this.socketRole,
|
||||
side: 'client',
|
||||
smartsocketHost: this,
|
||||
socket: plugins.socketIoClient(socketUrl, {
|
||||
socket: await socketIoClient.connect(socketUrl, {
|
||||
multiplex: false,
|
||||
reconnectionAttempts: 5,
|
||||
}),
|
||||
|
@ -25,10 +25,3 @@ export {
|
||||
smarttime,
|
||||
smartrx,
|
||||
};
|
||||
|
||||
// third party
|
||||
import socketIoClient from 'socket.io-client';
|
||||
|
||||
export {
|
||||
socketIoClient
|
||||
};
|
||||
|
@ -2,19 +2,15 @@
|
||||
import type http from 'http';
|
||||
import type https from 'https';
|
||||
|
||||
export {
|
||||
http,
|
||||
https
|
||||
};
|
||||
export { http, https };
|
||||
|
||||
// pushrocks scope
|
||||
import type * as smartexpress from '@pushrocks/smartexpress';
|
||||
|
||||
export {
|
||||
smartexpress
|
||||
};
|
||||
export { smartexpress };
|
||||
|
||||
// third party scope
|
||||
import type socketIo from 'socket.io';
|
||||
import type socketIoClient from 'socket.io-client';
|
||||
|
||||
export { socketIo };
|
||||
export { socketIo, socketIoClient };
|
||||
|
Reference in New Issue
Block a user