Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var app = require('http').createServer(handler)
- , io = require('socket.io').listen(app)
- , fs = require('fs')
- app.listen(88);
- var texto = 'AAA';
- function handler (req, res) {
- fs.readFile(__dirname + '/index.html',
- function (err, data) {
- if (err) {
- res.writeHead(500);
- return res.end('Error loading index.html');
- }
- res.writeHead(200);
- res.end(data);
- });
- }
- io.sockets.on('connection', function (socket) {
- socket.on('Text', function(data) {
- socket.emit('add', data);
- });
- socket.on('disconnect', function () {
- io.sockets.emit(' USER DISCONNECT ');
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment