My main application is the Django application, however, for some things in real time, I want to use Node / Socket.IO. I use Redis to create a pub / south from Django to Node (and then to various clients). The tricky part is how can I authenticate a Node user against Django auth?
In my Node application, I have:
io.on('connection', function (socket) { const subscribe = redis.createClient(); var userId = authenticateAndGetUserId(); subscribe.subscribe(userId + ':feed-items'); subscribe.on('message', function (channel, message) { socket.emit('feed-items', JSON.parse(message)); }); });
So my question is a good strategy for implementing authenticateAndGetUserId ? Sessions are supported in MySQL, so I can go through there. Just curious if there is a better way to do this.
Bialecki
source share