Browse Source

fix

bugfix/timeout-logging
Evan Feenstra 5 years ago
parent
commit
52be033500
  1. 24
      api/utils/socket.ts
  2. 19
      dist/api/utils/socket.js
  3. 2
      dist/api/utils/socket.js.map

24
api/utils/socket.ts

@ -2,19 +2,14 @@ const socketio = require("socket.io");
let io: any
function connect(server) {
export function connect(server) {
io = socketio(server);
io.on('connection', client => {
console.log("=> [socket.io] connected!")
client.on('event', data => { /* … */ });
client.on('disconnect', () => { /* … */ });
setTimeout(()=>{
client.emit('message','wazzup')
send('testing....')
},3000)
// io.sockets.send('{"try":"try"}')
// client.send('{"try":"try"}')
});
io.on('error', error => {
@ -22,19 +17,10 @@ function connect(server) {
})
}
const send = (body) => {
// srvr.clients.forEach(c=>{
// if(c) c.send(body)
// })
io.sockets.send(body)
export const send = (body) => {
io.sockets.emit('message',body)
}
const sendJson = (object) => {
export const sendJson = (object) => {
send(JSON.stringify(object))
}
export {
connect,
send,
sendJson
}

19
dist/api/utils/socket.js

@ -6,28 +6,19 @@ function connect(server) {
io = socketio(server);
io.on('connection', client => {
console.log("=> [socket.io] connected!");
client.on('event', data => { });
client.on('disconnect', () => { });
setTimeout(() => {
client.emit('message', 'wazzup');
exports.send('testing....');
}, 3000);
// io.sockets.send('{"try":"try"}')
// client.send('{"try":"try"}')
});
io.on('error', error => {
console.log(error);
});
}
exports.connect = connect;
const send = (body) => {
// srvr.clients.forEach(c=>{
// if(c) c.send(body)
// })
io.sockets.send(body);
exports.send = (body) => {
io.sockets.emit('message', body);
};
exports.send = send;
const sendJson = (object) => {
send(JSON.stringify(object));
exports.sendJson = (object) => {
exports.send(JSON.stringify(object));
};
exports.sendJson = sendJson;
//# sourceMappingURL=socket.js.map

2
dist/api/utils/socket.js.map

@ -1 +1 @@
{"version":3,"file":"socket.js","sourceRoot":"","sources":["../../../api/utils/socket.ts"],"names":[],"mappings":";;AAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAEtC,IAAI,EAAO,CAAA;AAE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