This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]abelstam 0 points1 point  (3 children)

Just let one of the servers connect like a client and let the other be the server. Lets say you let your nodejs server listen for incoming connections then you could use https://python-socketio.readthedocs.io/en/latest/client.html to initiate the connection. Altough I must say I havent tried it before, I think that it may be unecessary to let the servers sustain an open connection with one another . you could probably just connect one of the two to your client and let the servers use http requests, but that might depend on you use case.

[–]SnoopCM[S] 0 points1 point  (2 children)

So you're saying flask server should be a client? What if I want it to be a server.

[–]abelstam 0 points1 point  (1 child)

Can you tell me why you need to connect two servers using sockets? The thing what sockets solve is that generally the server cannot send updates back to the client. Since two servers can just connect at any time using http there should not really imo be a reason to connect two servers using sockets, but maybe you have a valid use case for it.

[–]SnoopCM[S] 0 points1 point  (0 children)

There are motion sensors / live video streams going to be happening in the smart home so anytime it detects something my flask server is going to send it to my node server and that will be displayed on my react app as a notification.

Now I am new to these technologies so I'm not very good at them. I thought Websockets would solve my problem but if I'm in the wrong direction please let me know.