events - Node.Js - letting users know someone is typing something -
i'm having chat app add imessage/facebook feature people know when each others typing something, changing name's color e.g.
i have tried :
$messagebox.keydown(function(){ if($(this).val().length!=0){ socket.emit('writing_message')}; }); socket.on('showing_writers',function(){ $users.html(''); // test if event received, not case... });
i hoping way, everytime user presses letters, trigger basic event on server, respond :
socket.on('writing_message',function(){ io.sockets.emit('showing_writers', socket.nickname); }
socket.nickname contains user's nickname use find him on client's files, in order change name's color.
does know how in better way, , why i'm doing not working ?
Comments
Post a Comment