Client cannot listen for connect events?

  node.js, question
var events = require('events');
 var net = require('net');
 var channel = new events.EventEmitter();
 channel.clients = {};
 channel.subscriptions = {};
 
 channel.on('join',function(id,client){
 console.log('connect');
 this.clients[id] = client;
 this.subscriptions[id] = function(senderId,message){
 console.log(message);
 if(id !  = senderId){
 this.clients[id].write(message);
 bracket
 };
 this.on('broadcast',this.subscriptions[id]);
 });
 
 var server =  net.createServer(function(client){
 Var id = client.remoteAddress plus':' plus client.remotePort;
 client.on('connect',function(){
 console.log('client connect');
 channel.emit('join',id,client);
 });
 client.on('data',function(data){
 data = data.toString();
 console.log(data);
 channel.emit('broadcast',id,data);
 });
 });
 server.listen(8887);

This sentence has never been carried out, Why?. client.on(‘connect’,function(){ console.log(‘client connect’); channel.emit(‘join’,id,client); });

Net.Server now EventEmitter has close, connection, error, listening, net.Socket has connect, you can start connect by replacing net.createServer with net.createSocket Wouldn’t it be better to write this function with socket.io?