Accessing the user's uid in the plugin's library.js

  • I can access the uid value in my plugin's controller using this req.uid.

    Now I need to access this uid value in the plugin's library.js. How can I access it?

    One way is to send the uid in the ajaxify data object (passed to res.render()) which is accessible to the client side js in the object, and pass the uid from client side to socket.emit. Finally, library.js can access the socket data. But this seems to be a long procedure.

    Is there any other easy way to achieve this?

  • Global Moderator

    @cool socket.uid works for socket handlers. The socket object is the first argument.

  • Cool answer.. It worked. Thanks.

Suggested Topics

| |