How communicate server with client[NodeBB plugin]
-
I read different tutorial like this:
https://community.nodebb.org/topic/2407/how-to-send-alerts-to-users-after-user-creation/2
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
Copyright © 2024 NodeBB | Contributors