We are writing an Application- which need a dummy user as a socket.io client with the user ,which will act as a dummy user , to send and recieve messages . Each user will have the dummy client that should be able to send message to client(User).
I need help for implementing this.
This is my server connection handler .I want to create a socket.io client here , as new client is connected on server .Can i develope it if yes then how ?
self.socket.on('connection', function(client){
//here i want to create a seperate module for handling dummy users
// for sending and recieving message.
});
How will i include Socket.io Client Script in node ? updating the client i write on server
exports.init=function(){
var socket = new io.Socket(config.host, {port: config.port, rememberTransport: false});
// when connected, clear out display
socket.on('connect',function() {
console.log('dummy user connected');
});
socket.on('disconnect',function() {
console.log('disconnected dummy');
});
socket.on('message', function(data){
console.log(data);
});
socket.connect();
return socket;
};
Here i am creating the client
if (message._command=='login') {
console.log('creating client of '+sessionId);
var socket=client.init();
console.log(socket);
}
This console is printed .