Connect C++ to PHP React WsServer / WampServer

27 views
Skip to first unread message

Brian Pez

unread,
Jun 5, 2018, 8:32:06 AM6/5/18
to Autobahn
I have an existing PHP server (which I didn't write) running WebSockets and a WampServer.  Works for PHP and ajax connections.

I am trying to use the C++ Autobahn implementation and I can't get the client to connect.  Doesn't matter if I use the samples that came with the source or my own implementation.  it just hangs (waits forever) on (from subscriber.cpp):
        connect_future = transport->connect().then([&](boost::future<void> connected) {

As soon as I close the PHP server, I get a Boost error which isnt' tied to one of the try/catch blocks:
rawsocket handshake error: asio.misc:2

If I try to connect without the PHP server running, I immediately exit from the 
io.run();
call with no error messages.

Based on the error, I assume it is connecting but the PHP server isn't sending back the expected response?  Not really sure where to start here since the server is working for the non-C++ code.

TIA!
- Brian

Brian Pez

unread,
Jun 5, 2018, 8:36:55 AM6/5/18
to Autobahn
Should have mentioned the PHP server is using React and Ratchet.

DV Henkel-Wallace

unread,
Jun 5, 2018, 9:39:59 AM6/5/18
to autob...@googlegroups.com
Can you get (say) the python example to connect to the router and register an RPC and have another python example call the RPC?
Can you do the same with c++ (this would be with a different domain, though you can still use your existing router).

Let me know if those work.

-- 
You received this message because you are subscribed to the Google Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send an email to autobahnws+...@googlegroups.com.
To post to this group, send email to autob...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/687f8009-507e-478b-a777-ddd9610563ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brian Peschel

unread,
Jun 5, 2018, 10:03:00 AM6/5/18
to autob...@googlegroups.com
I don't know anything about python.  I followed the directions in
autobahn-python/examples/running-the-examples.md

and ran the basic subscriber and got the following error:
python asyncio/wamp/pubsub/basic/frontend.py 
  File "asyncio/wamp/pubsub/basic/frontend.py", line 38
    async def onJoin(self, details):
            ^
SyntaxError: invalid syntax

This is on Fedora 28, Python 2.7.15

<shrug>  I guess I could hard code the server to intercept the messages and use ZeroMQ to send the data to the C program.....
- b


On Tue, Jun 5, 2018 at 8:39 AM, DV Henkel-Wallace <gu...@henkel-wallace.org> wrote:
Can you get (say) the python example to connect to the router and register an RPC and have another python example call the RPC?
Can you do the same with c++ (this would be with a different domain, though you can still use your existing router).

Let me know if those work.
On Jun 5, 2018, at 22:36, Brian Pez <br...@techstrength.com> wrote:

Should have mentioned the PHP server is using React and Ratchet.

On Tuesday, June 5, 2018 at 7:32:06 AM UTC-5, Brian Pez wrote:
I have an existing PHP server (which I didn't write) running WebSockets and a WampServer.  Works for PHP and ajax connections.

I am trying to use the C++ Autobahn implementation and I can't get the client to connect.  Doesn't matter if I use the samples that came with the source or my own implementation.  it just hangs (waits forever) on (from subscriber.cpp):
        connect_future = transport->connect().then([&](boost::future<void> connected) {

As soon as I close the PHP server, I get a Boost error which isnt' tied to one of the try/catch blocks:
rawsocket handshake error: asio.misc:2

If I try to connect without the PHP server running, I immediately exit from the 
io.run();
call with no error messages.

Based on the error, I assume it is connecting but the PHP server isn't sending back the expected response?  Not really sure where to start here since the server is working for the non-C++ code.

TIA!
- Brian

-- 
You received this message because you are subscribed to the Google Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send an email to autobahnws+unsubscribe@googlegroups.com.

To post to this group, send email to autob...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/687f8009-507e-478b-a777-ddd9610563ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send an email to autobahnws+unsubscribe@googlegroups.com.

To post to this group, send email to autob...@googlegroups.com.

Brian Peschel

unread,
Jun 5, 2018, 1:16:09 PM6/5/18
to autob...@googlegroups.com
the WAMP_POCO fork has a javascript version which is reporting a 'Error during Websocket handshake: Unexpected response code 426'.  Looking in the console, at the network messages, I see

426: No Sec-WebSocket-Protocols requested supported

So, I assume there is an issue at the server.....

- B
Reply all
Reply to author
Forward
0 new messages