I am getting no Websocket connection between client script and server.
It is working fine in my local environment.
Also I am following this link.
Here's a server script that initializes the websocket server and listens for the client connection to 8080
port.
public function run()
{
$loop = Factory::create();
$pusher = new Pusher;
$context = new Context($loop);
$pull = $context->getSocket(ZMQ::SOCKET_PULL);
$pull->bind('tcp://127.0.0.1:5555'); // Binding to 127.0.0.1 means the only client that can connect is itself
$pull->on('message', array($pusher, 'onBlogEntry'));
// Set up our WebSocket server for clients wanting real-time updates
$webSock = new Server('0.0.0.0:8080', $loop); // Binding to 0.0.0.0 means remotes can connect
$webServer = new IoServer(
new HttpServer(
new WsServer(
new WampServer(
$pusher
)
)
),
$webSock
);
$loop->run();
And here's the client script:
var conn = new ab.Session('ws://localhost:8080',
function() {
/* subscribe to following topics */
conn.subscribe('new_order', function(topic, data) ..
Again, this is working fine in the local setup.
Also to note, my application is hosted using a specified port from docker container.
http://192.168.12.52:8094/xyz/new/....
I also tried specifying the IP in the client script:
var conn = new ab.Session('ws://192.168.12.52:8080',
function() {
/* subscribe to following topics */
conn.subscribe('new_order', function(topic, data) ...
In which case I get the following error:
WebSocket connection to 'ws://192.168.11.32:8080/' failed: Error during WebSocket handshake: Unexpected response code: 403
What is missing here?