You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const socketio = require("socket.io");
|
|
|
|
let io;
|
|
|
|
function connect(server) {
|
|
|
|
io = socketio(server);
|
|
|
|
io.on('connection', client => {
|
|
|
|
console.log("=> [socket.io] connected!");
|
|
|
|
client.on('event', data => { });
|
|
|
|
client.on('disconnect', () => { });
|
|
|
|
// io.sockets.send('{"try":"try"}')
|
|
|
|
// client.send('{"try":"try"}')
|
|
|
|
});
|
|
|
|
}
|
|
|
|
exports.connect = connect;
|
|
|
|
const send = (body) => {
|
|
|
|
// srvr.clients.forEach(c=>{
|
|
|
|
// if(c) c.send(body)
|
|
|
|
// })
|
|
|
|
io.sockets.send(body);
|
|
|
|
};
|
|
|
|
exports.send = send;
|
|
|
|
const sendJson = (object) => {
|
|
|
|
send(JSON.stringify(object));
|
|
|
|
};
|
|
|
|
exports.sendJson = sendJson;
|
|
|
|
//# sourceMappingURL=socket.js.map
|