I\'m trying to use two websockets on one page. This is my code:
var pageViewWs = new WebSocket(\"ws://localhost:9002/pageView\");
var sessionWs = new WebSoc
I faced the same problem to run multiple services through the same port. So, I created a PHP library to do this.
Some free plans of hosting providers don't allow you to bind to ports or allow you to bind to one port. In case of OpenShift Cloud Server, you can only bind to port 8080. So, running multiple WebSocket services is not possible. In this case, Francium DiffSocket is useful.
You can run different services on the same port using a PHP library called Francium DiffSocket.
After setting up Francium DiffSocket, you can do this for using different services :
var chatWS = new WebSocket("ws://ws.example.com:8000/?service=chat");
var gameWS = new WebSocket("ws://ws.example.com:8000/?service=game");
An example are these services which are running through a single port :