hinos-socketio
TypeScript icon, indicating that this package has built-in type declarations

2.0.11 • Public • Published

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);
    }
}

Readme

Keywords

none

Package Sidebar

Install

npm i hinos-socketio

Weekly Downloads

1

Version

2.0.11

License

ISC

Last publish

Collaborators

  • doanthuanthanh88