# hinos-socketio
A plugin manages socketio connect for [hinos](https://github.com/doanthuanthanh88/hinos)

# Install
```nodejs
npm i hinos-socketio -S
```

# Examples

### Typescript
Socketio configuration file
```nodejs
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
```nodejs
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);
    }
}
```