Emit socket event from server?
-
I saw in another post that @julian recommended doing something like the following:
websockets.server.sockets.in('user/' + uid).emit('event:alert', { title: 'test', message: 'something' ... });
What should I
require
to get websockets?Something like
module.parent.require("websockets")
? -
@julian Wait, but is it
'./socket.io'
or just'socket.io'
. There is nosocket.io.js
file in the src directory. -
Oh, okay. I though node required a
package.json
for a folder to be required or recognized as a module. -
@julian In that case, if I'm using both
./socket.io
and./socket.io/plugins
, do I need to manually require plugins, or can I refer to it viawebsocket.plugins
or something?BTW, sorry for the pings.
-
Copyright © 2024 NodeBB | Contributors