UNPKG

@wbg-mde/server

Version:

MDE communication channel with Socket IO and express.

33 lines 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const module_soocket_1 = require("./module.soocket"); class MainSocket { /* * Init and start the socket *******************************************/ init(http) { const io = require('socket.io')(http); // #. Track connections io.on('connection', (socket) => { // #. Assign active socket this.socket = socket; // #. Track disconnect this.socket.on('disconnect', () => { console.log('disconnected'); }); this.socket.on('stop', () => { this.socket.destroy(); }); this.initAll(); }); } initAll() { let all = new module_soocket_1.ModuleSocket(); all.initAll(this.socket); } emit(data) { this.socket.emit('mde-server-resp', data); } } exports.MainSocket = MainSocket; //# sourceMappingURL=main.socket.js.map