|
|
|
@ -22,19 +22,18 @@ app.use(express.static(path.join(__dirname, "public")));
|
|
|
|
|
|
|
|
|
|
var io = require('socket.io')(server);
|
|
|
|
|
|
|
|
|
|
io.on('connection', function(socket){
|
|
|
|
|
|
|
|
|
|
io.on('connection', function(socket){
|
|
|
|
|
|
|
|
|
|
parser.on('data', function(data) {
|
|
|
|
|
const msg = data.split(' ');
|
|
|
|
|
console.log(msg[0], msg[1]);
|
|
|
|
|
io.emit(msg[0], msg[1]);
|
|
|
|
|
io.emit('node-data', data);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
console.log('Node.js is listening!!');
|
|
|
|
|
socket.on("hello", (arg, callback) => {
|
|
|
|
|
console.log("hellohelo"); // "world"
|
|
|
|
|
io.emit('world');
|
|
|
|
|
|
|
|
|
|
socket.on("blink", (arg, callback) => {
|
|
|
|
|
io.emit('blink');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
socket.on('chat message', (msg) => {
|
|
|
|
|