fix(core): update
This commit is contained in:
@ -91,7 +91,13 @@ export class SmartsocketClient {
|
||||
public async connect() {
|
||||
const done = plugins.smartpromise.defer();
|
||||
const smartenvInstance = new plugins.smartenv.Smartenv();
|
||||
const socketIoClient = plugins.socketIoClient;
|
||||
const socketIoClient: any = await smartenvInstance.getEnvAwareModule({
|
||||
nodeModuleName: 'socket.io-client',
|
||||
webUrlArg: 'https://cdn.jsdelivr.net/npm/socket.io-client@4/dist/socket.io.js',
|
||||
getFunction: () => {
|
||||
return (globalThis as any).io;
|
||||
},
|
||||
});
|
||||
logger.log('info', 'trying to connect...');
|
||||
const socketUrl = `${this.serverUrl}:${this.serverPort}`;
|
||||
this.socketConnection = new SocketConnection({
|
||||
|
@ -26,7 +26,7 @@ export interface ISocketConnectionConstructorOptions {
|
||||
authenticated: boolean;
|
||||
side: TSocketConnectionSide;
|
||||
smartsocketHost: Smartsocket | SmartsocketClient;
|
||||
socket: pluginsTyped.socketIo.Socket | plugins.socketIoClient.Socket;
|
||||
socket: pluginsTyped.socketIo.Socket | pluginsTyped.socketIoClient.Socket;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -47,7 +47,7 @@ export class SocketConnection {
|
||||
public side: TSocketConnectionSide;
|
||||
public authenticated: boolean = false;
|
||||
public smartsocketRef: Smartsocket | SmartsocketClient;
|
||||
public socket: pluginsTyped.socketIo.Socket | plugins.socketIoClient.Socket;
|
||||
public socket: pluginsTyped.socketIo.Socket | pluginsTyped.socketIoClient.Socket;
|
||||
|
||||
public eventSubject = new plugins.smartrx.rxjs.Subject<interfaces.TConnectionStatus>();
|
||||
public eventStatus: interfaces.TConnectionStatus = 'new';
|
||||
|
@ -27,9 +27,3 @@ export {
|
||||
smarttime,
|
||||
smartrx,
|
||||
};
|
||||
|
||||
// thirdparty
|
||||
import * as socketIoClient from 'socket.io-client';
|
||||
export {
|
||||
socketIoClient
|
||||
}
|
||||
|
@ -11,6 +11,10 @@ export { smartexpress };
|
||||
|
||||
// third party scope
|
||||
import type socketIo from 'socket.io';
|
||||
import type socketIoClient from 'socket.io-client';
|
||||
import type { Socket as ClientSocket, connect as ClientIo } from 'socket.io-client';
|
||||
|
||||
export { socketIoClient, socketIo };
|
||||
export { socketIo };
|
||||
export namespace socketIoClient {
|
||||
export type Socket = ClientSocket;
|
||||
export type connect = typeof ClientIo;
|
||||
}
|
||||
|
Reference in New Issue
Block a user