I surf the internet looking for a direct answer, but most solutions include using Express and serving HTTP content for secure connections. I'm more interested in secure web socket connection ( wss ) for Node.js and socket.io
I do not use Node.js for HTTP requests. I use the socket.io module, which works with Node.js to deliver real-time messages to my applications. I am using node to connect to a web socket.
I will explain what my setting is. I use Django as my HTTP server. Users make a Django request, Django sends the contents of this request to Redis, Node.js listens to one of the Redis channels, processes the content and sends a message to the appropriate recipient.
Pretty simple and straightforward. Everything is working fine. But I'm afraid that connecting to a webcam with Node.js is unsafe. When Node.js sends a message to the recipient, I donβt want anyone to track between them and intercept the message. I would like to make sure that my users feel secure and trust the service I created for them.
I looked at self-signed certificates and certificates from CA. Both provide the same level of security. Since I use Node.js for socket.io and do not serve HTTP content, the self-signed certificate will work absolutely fine (the service I created for mobile devices, not browsers!)
Below is my implementation of socket.io:
var io = require('socket.io').listen(8000); var redis = require('socket.io/node_modules/redis') var redisChannelConnection = redis.createClient(6000, "12.345.678.9"); var redisServer = redis.createClient(6000, "23.456.789.1"); // Subscribe to Redis Channel redisChannelConnection.subscribe('messages'); io.sockets.on('connection', function (socket) { socket.emit('message', 'Hello World'); }
I just wrote a simple join function. It works like a normal websocket connection. But I would like to make this a secure network connection. . How much do I do this?
Thank you for your help.
noahandthewhale
source share