starting db connection and cleaning things out

This commit is contained in:
talksik
2022-06-08 05:18:05 -05:00
parent 290387e2f9
commit 52af5de552
44 changed files with 217 additions and 1553 deletions
+26
View File
@@ -0,0 +1,26 @@
export default function InitializeWs(io: any) {
console.log('initializing web sockets');
return io
.use(function (socket: any, next: any) {
console.log('authenticating user...');
try {
// const { token } = socket.handshake.query;
// console.log(token);
// verify jwt token with our api secret
// var decoded: JwtClaims = jwt.verify(token, config.JWT_TOKEN_SECRET);
// socket.userInfo = decoded;
next();
} catch (error) {
console.error(error);
next(new Error('WS Authentication Error'));
}
})
.on('connection', (socket: any) => {
console.log(`connected`, socket.id);
});
}