hinos-socketio
A plugin manages socketio connect for hinos
Install
npm i hinos-socketio -S
Examples
Typescript
Socketio configuration file
import { Server } from 'hinos';
import { Socketio } from 'hinos-socketio';
Socketio({
server: Server.server,
path: {
'msg': undefined // Or {register(sessionId) { // Do something }} Or (socket: SocketIO.Socket) => { }
}
}).debug(!Server.isProduction)
Service file
import { SOCKETIO, Socketio } from 'hinos-socketio';
export class ChartService {
@SOCKETIO()
static socketio: Socketio;
static async find(sessionId: string, data: any = {}) {
await ChartService.socketio.send('/msg', sessionId, data);
}
}