0

I have built a chatting website using NodeJS and socket.io. I want to encrypt and secure the connection between the two or more users chatting for safe message transfer. How can I do this?

  • 1
    Does this answer your question? [node.js, socket.io with SSL](https://stackoverflow.com/questions/6599470/node-js-socket-io-with-ssl) – Someone Special May 07 '21 at 11:11

1 Answers1

0

Simple answer.. Use SSL for your socket server

When you crease a websocket you have two protocols, WS and WSS you want the latter WSS, socket.io will automatically use WSS if your socket server is using SSL, this will ensure encryption (in transit)

You can go deeper if you wish, encrypting at rest on the DB and then decrypt before sending OR on the client but if the use case is to just encrypt in transit then adding a cert to the endpoint should work.

proxim0
  • 1,418
  • 2
  • 11
  • 14