Reputation: 120
I'm trying to use websockets mainly for pushing data from server to client on events.
So, i configured locally Thruway and Autobahn.js twice: by myself and with help of this tutorial.
Server starts correctly:
./bin/console thruway:router:start
Making a go at starting the Thruway Router
2018-05-23T00:29:33.6760270 debug [Thruway\Peer\Router 17047] New router created
2018-05-23T00:29:33.6830490 info [Thruway\Peer\Router 17047] Starting router
2018-05-23T00:29:33.6853010 info [Thruway\Transport\RatchetTransportProvider 17047] Websocket listening on 127.0.0.1:9998
2018-05-23T00:29:33.6864550 info [Thruway\Transport\RatchetTransportProvider 17047] Websocket listening on 127.0.0.1:9999
2018-05-23T00:29:33.6865040 info [Thruway\Peer\Router 17047] Starting loop
Browser code is very simple:
var connection = new autobahn.Connection({
url: 'ws://127.0.0.1:9999/',
realm: 'realm1'
});
connection.onopen = function (session, details) {
console.info('Connection opened: ' + session + ' | ' + details);
};
connection.onclose = function (reason, details) {
console.info('Connection closed: ' + reason + ' | ' + details);
};
connection.open();
But i see error 426 No Sec-WebSocket-Protocols requested supported
in browsers (Safari, Chrome, FireFox).
After some googling, i found only very old questions/answers (2014..2016) where people says that Authobahn.js use WAMPv2 but Ratchet only WAMPv1.. but i see that WAMPv2 is supported by Thruway library in 2017-2018.
My question is simple: how to make this work? Or, maybe, with angularWAMP? Any examples are appreciated, thanks.
Versions:
~ composer show -D
sensio/distribution-bundle v5.0.21 Base bundle for Symfony Distributions
sensio/framework-extra-bundle v5.1.6 This bundle provides a way to configure your controllers with annotations
sensio/generator-bundle v3.1.7 This bundle generates code for you
symfony/monolog-bundle v3.2.0 Symfony MonologBundle
symfony/phpunit-bridge v4.0.9 Symfony PHPUnit Bridge
symfony/polyfill-apcu v1.8.0 Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/swiftmailer-bundle v3.2.2 Symfony SwiftmailerBundle
symfony/symfony v3.4.9 The Symfony PHP framework
thruway/pawl-transport 0.5.0 Pawl WebSocket Transport for Thruway Client
voryx/thruway-bundle 0.3.1 WebSockets (WAMP2) integration for Symfony2
Autobahn is 18.3.2
Upvotes: 1
Views: 856