How send a message with socket from library.js (server side) to file.js(client side) without uid


  • GNU/Linux

    Suppose there are two files.

    library.js in the /nodebb-plugin-namePlugin
    file.js in /nodebb-plugin-namePlugin/static/lib

    Now I must do a lot of operation in my library.js and I must check when user is created. So I use the hook and It's everything ok, but, after I must my check in library I need to send a message to my file.js to change background color of a component. The proble is that I used this to communicate:

    websockets = module.parent.require('./socket.io'), //library.js
    websockets.in('uid_' + data.uid).emit('hash', {
    				'username': data.data.username
    	
    	});     
     //file.js
    socket.on('hash',function(){
    				console.log("DOG);
    			});  
    

    The problem is that I don't have data.uid value because I'm checking before that an user can registrate himself. Anyone can help me to use websocket without uid or can suggest me other methods?


 

Suggested Topics

| |