I am creating a chat server with nodejs and mongo as a demo. I have it where each user can send another authenticated user a message. What I am trying to do now is make is scalable.
My Idea is to save the sockets inside MongoDB and then have several node servers running that check to see if that user is online in the DB, if so, send the message to that socket.
Although when I try to store the socket in the DB via JSON.Stringify
into a type:String
, it gives me an error: 'Exception in cluster master process: Converting circular structure to JSON'
Any help would be great!
Thanks,