Socket io connection to remote server using global variables


Problem context

We are building a cloud solution with number of applications. For its UI we are using meteor (React, Redux, react-router). All of cloud operations are being performed on different application (X) built in node.js and loopback. Whenever we perform any operation from UI we call X from meteor server and listen to operation updates on socket io. Due to security reasons we cannot make socket io connection to this server on meteor client side. We have to make socket io connection on meteor server side. To solve this problem I was using /lib directory to make my socket io connection there and then use socket-io global variable to listen for updates in UI

socket_client = {};
const io = require(“”);

socket_client = io.connect(“http://X”);

I can make connection successfully, but when I use socket_client variable in my UI it is coming as empty object, although I can see it has socket-io connection on server side.

Please suggest me how can I solve this issue. What I want is, to make a socket io connection on meteor server side with application X and listen for operation updates on meteor client side.


Anyone?? I really need to solve this during this sprint.