deneme-9 (socket.io)

node v8.11.3
version: 1.0.0
endpointsharetweet
app=require('http').createServer(handler); io=require('socket.io')(app); app.listen(3000); function handler(req,res){ var veri=`<!DOCTYPE html> <html> <head> <script src='/socket.io/socket.io.js'></script> <script> var socket=io('/'); socket.on('news',function(data){ console.log(data); socket.emit('my other event',{my:'data'});}); </script> </head> <body> </body> </html>`; res.writeHead(200, {'Content-Type': 'text/html'}); res.end(veri); } io.on('connection',function(socket){ socket.emit('news',{hello:'world'}); socket.on('my other event',function(data){ console.log(data); }); });
//console.log(process.env.RUNKIT_ENDPOINT_URL); //process.env.RUNKIT_MOUNT_PATH
Loading…

no comments

    sign in to comment