Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

361
Views
Autobahn-js failes to connect to Ratchet Server (Wamp)

I've already checked plenty of questions and tutorials and I'm following the official documentation from socketme portal. I'm running this on XAMPP/Localhost.

Websocket works, when I'm not using the WAMP interface. Otherwise, it fails to connect and doesn't state any reason.

Error is: "app.js:6200 WebSocket connection to 'ws://localhost:8080/socket' failed: connection closed unreachable"

Server

$server = new \Ratchet\App('localhost', 8080);
$server->route('/socket', new WebSocketHandler, array('*'));
$server->run();

WebSocketHandler is a basic implementation of WampServerInterface and only includes the abstracted methods without any change.

On the client side, I'm doing the following to try a connection via autobahn-js:

           var connection = new Autobahn.Connection({

            transports: [{
                type: 'websocket',
                port: 8080,
                host: 'localhost',
                url: 'ws://localhost:8080/socket'
            }],
            realm: 'realm1'
        });

        connection.onopen = function(session) {
            app.content = app.content + `connected!`
        };

        connection.onclose = function(reason, details) {
            app.content = app.content + `onclose!`
        }

        connection.open();

I've done something wrong in this implementation, but I can't figure it out. I've tried avoiding the ->route approach and using the following vanilla approach:

$server = IoServer::factory(
    new HttpServer(
        new WsServer(
            new WampServer(
              new WebSocketHandler()
              )
        )
    ),
    8080
);

But, it didn't work.

Any help is much appreciated.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You need Autobahn.js 0.8.2 to connect it to Ratchet (WAMP v1) and it's a pretty old implementation and also ab 0.8.2 is extremely old.

You should navigate your work to Thruway. I tried doing it, but I couldn't find any custom implementation of Thruway RatcherRouter (onMessage, onOpen, etc.), therefore, I decided to do my own (pretty bad) implementation of Ratchet.

TL;DR: Switch to Thruway.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!