21 lines
371 B
TypeScript
21 lines
371 B
TypeScript
import { Server } from 'socket.io'
|
|
import AdonisServer from '@ioc:Adonis/Core/Server'
|
|
|
|
class Ws {
|
|
public io: Server
|
|
private booted = false
|
|
|
|
public boot() {
|
|
/**
|
|
* Ignore multiple calls to the boot method
|
|
*/
|
|
if (this.booted) {
|
|
return
|
|
}
|
|
|
|
this.booted = true
|
|
this.io = new Server(AdonisServer.instance!)
|
|
}
|
|
}
|
|
|
|
export default new Ws() |