fix(core): update

This commit is contained in:
2022-03-24 12:52:28 +01:00
parent be9b47e73b
commit 75bd7a9175
6 changed files with 2808 additions and 3213 deletions

View File

@ -46,8 +46,8 @@ export class Smartsocket {
* starts smartsocket
*/
public async start() {
const socketIoModule = this.smartenv.getSafeNodeModule('socket.io');
this.io = socketIoModule(await this.socketServer.getServerForSocketIo());
const socketIoModule = await this.smartenv.getSafeNodeModule('socket.io');
this.io = new socketIoModule.Server(await this.socketServer.getServerForSocketIo());
await this.socketServer.start();
this.io.on('connection', (socketArg) => {
this._handleSocketConnection(socketArg);

View File

@ -47,7 +47,7 @@ export class SocketServer {
if (this.httpServer) {
return this.httpServer;
} else {
const httpModule = this.smartsocket.smartenv.getSafeNodeModule('http');
const httpModule = await this.smartsocket.smartenv.getSafeNodeModule('http');
this.httpServer = new httpModule.Server();
this.standaloneServer = true;
return this.httpServer;

View File

@ -10,10 +10,13 @@ import type * as smartexpress from '@pushrocks/smartexpress';
export { smartexpress };
// third party scope
import type socketIo from 'socket.io';
import type { Socket as ServerSocket, Server as ServerServer} from 'socket.io';
import type { Socket as ClientSocket, connect as ClientIo } from 'socket.io-client';
export { socketIo };
export namespace socketIo {
export type Socket = ServerSocket;
export type Server = ServerServer;
}
export namespace socketIoClient {
export type Socket = ClientSocket;
export type connect = typeof ClientIo;