My sio = require('socket.io').listen(app) is in my server.js file, but I’m calling a method in a library that would like to push a message to the client… say api.user.pushToClient()
How am I able to access sio.sockets from there? Perhaps my structure is incorrect?
Folder structure:
server.js
api
|--user.js
|--another.js
in
server.jsappend this linein
api/user.jsOr did I misunderstand the question?