fix(core): update
This commit is contained in:
@ -103,7 +103,7 @@ export class Smartsocket {
|
||||
/**
|
||||
* the standard handler for new socket connections
|
||||
*/
|
||||
private async _handleSocketConnection(socketArg: SocketIO.Socket) {
|
||||
private async _handleSocketConnection(socketArg: pluginsTyped.socketIo.Socket) {
|
||||
const socketConnection: SocketConnection = new SocketConnection({
|
||||
alias: undefined,
|
||||
authenticated: false,
|
||||
|
@ -91,13 +91,7 @@ export class SmartsocketClient {
|
||||
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;
|
||||
},
|
||||
});
|
||||
const socketIoClient = plugins.socketIoClient;
|
||||
logger.log('info', 'trying to connect...');
|
||||
const socketUrl = `${this.serverUrl}:${this.serverPort}`;
|
||||
this.socketConnection = new SocketConnection({
|
||||
|
@ -1,4 +1,5 @@
|
||||
import * as plugins from './smartsocket.plugins';
|
||||
import * as pluginsTyped from './smartsocket.pluginstyped';
|
||||
import * as interfaces from './interfaces';
|
||||
|
||||
// import classes
|
||||
@ -7,7 +8,6 @@ import { SocketFunction } from './smartsocket.classes.socketfunction';
|
||||
import { SocketRequest, ISocketRequestDataObject } from './smartsocket.classes.socketrequest';
|
||||
|
||||
// socket.io
|
||||
import * as pluginsTyped from './smartsocket.pluginstyped';
|
||||
import { SmartsocketClient } from './smartsocket.classes.smartsocketclient';
|
||||
import { logger } from './smartsocket.logging';
|
||||
|
||||
@ -26,7 +26,7 @@ export interface ISocketConnectionConstructorOptions {
|
||||
authenticated: boolean;
|
||||
side: TSocketConnectionSide;
|
||||
smartsocketHost: Smartsocket | SmartsocketClient;
|
||||
socket: SocketIO.Socket | SocketIOClient.Socket;
|
||||
socket: pluginsTyped.socketIo.Socket | plugins.socketIoClient.Socket;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -47,7 +47,7 @@ export class SocketConnection {
|
||||
public side: TSocketConnectionSide;
|
||||
public authenticated: boolean = false;
|
||||
public smartsocketRef: Smartsocket | SmartsocketClient;
|
||||
public socket: SocketIO.Socket | SocketIOClient.Socket;
|
||||
public socket: pluginsTyped.socketIo.Socket | plugins.socketIoClient.Socket;
|
||||
|
||||
public eventSubject = new plugins.smartrx.rxjs.Subject<interfaces.TConnectionStatus>();
|
||||
public eventStatus: interfaces.TConnectionStatus = 'new';
|
||||
|
@ -27,3 +27,9 @@ export {
|
||||
smarttime,
|
||||
smartrx,
|
||||
};
|
||||
|
||||
// thirdparty
|
||||
import * as socketIoClient from 'socket.io-client';
|
||||
export {
|
||||
socketIoClient
|
||||
}
|
||||
|
Reference in New Issue
Block a user