fix(core): update
This commit is contained in:
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user