In my project, i have some sockets which needs to be authenticated and some sockets which are not containing the auth-token.
const socket = require('socket.io');
let server = require('http').createServer(app);
require('./config/authSockets')(socket(server));
require('./config/sockets')(socket(server));
I have created separate files for this scenario that in authSockets, first it should check that if socket has the token then it'll open the connection only and emit those sockets. and the next file which is ./config/sockets this file should run everytime and it donot require the socket. but my code isn't working, its always only accept the second file.