We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7e105f3 commit 1dfd3d6Copy full SHA for 1dfd3d6
middlewares/socketio.js
@@ -3,6 +3,7 @@ const { JWT_SECRET } = require('../config');
3
4
const { sendMessage } = require('../controllers/messages');
5
6
+// Socket.IO Middleware for Auth
7
function socketAuth(socket, next) {
8
const { token } = socket.handshake.query;
9
@@ -22,7 +23,10 @@ function socketAuth(socket, next) {
22
23
function socketio(io) {
24
io.use(socketAuth);
25
- io.on('connection', (socket) => {
26
+ const v1 = io.of('/v1');
27
+
28
+ // TODO: Move this sockets handlers somewhere
29
+ v1.on('connection', (socket) => {
30
socket.on('mount-chat', (chatId) => {
31
socket.join(chatId);
32
});
0 commit comments