NodeJs Implements Simple Broadcasting

  node.js, question

Broadcasting cannot be realized after linking with telnet 127.0.0.1 8888

var events = require('events');
 var net = require('net');
 
 var channel = new events.EventEmitter();
 channel.clients = {};
 channel.subscriptions = {};
 
 channel.on('join', function(id, client) {
 this.clients[id] = client;
 this.subscriptions[id] = function(senderId, message) {
 if (id !  = senderId) {
 this.clients[id].write(message);
 bracket
 };
 this.on('broadcast', this.subscriptions[id]);
 });
 
 channel.on('leave', function(id) {
 channel.removeListener('broadcast', this.subscriptions[id]);
 Channel.emit('broadcast', id, id plus "has left the chat.\n");
 });
 
 channel.on('shutdown', function() {
 channel.emit('broadcast', '', "Chat has shut down.\n");
 channel.removeAllListeners('broadcast');
 });
 
 var server = net.createServer(function(client){
 Var id = client.remoteAddress plus':' plus client.remotePort;
 client.on('connect', function() {
 channel.emit('join', id, client);
 });
 client.on('data', function(data) {
 data = data.toString();
 if (data == "shutdown\r\n") {
 channel.emit('shutdown');
 bracket
 channel.emit('broadcast', id, data);
 });
 
 client.on('close', function() {
 channel.emit('leave', id);
 });
 
 });
 
 server.listen(8888);

With socket.io,https://www.npmjs.com/package/socket.ioCan you give it a try?