How communicate server with client[NodeBB plugin]
-
I read different tutorial like this:
How to send alerts to users after user creation?
Hi @vatsal, I just forked your post The app object is only available client-side, so when you are on the server side listening for the action:user.create ho...
NodeBB Community (community.nodebb.org)
But for me it doesn't work. My purpose is when a user publics a post the program shows a message of welcome with some like app.alert, this is the code(library.js):
var websockets = module.parent.require('./socket.io');
//and in the method that captures the hook for the post i write
websockets.server.sockets.in('user/' + uid).emit('event:alert', {
title: 'test', message: 'something' });
The problem is that I don't see the alert so I'wroing something. Anyone can help me?
-
Try changing this part
websockets.server.sockets.in('user/' + uid)
to
websockets.in('uid_' + uid)
-
what is the value of
uid