tplgy / bonefish

C++ WAMP application router that enables building applications from loosely-coupled components.
Apache License 2.0
55 stars 33 forks source link

inter-operate with AutobahnCpp example #6

Closed allspace closed 9 years ago

allspace commented 9 years ago

Compile AutobahnCpp example https://github.com/tavendo/AutobahnCpp/blob/master/examples/call1.cpp and use it to connect to bonefish server. (there is no one register the RPC method to be called). I'd expect bonefish can return error indicate that RPC method does not exist.

On client side, I got the following message: [root@wanzh02-usb-1 src]# ./caller Running on 105800 Starting ASIO I/O loop .. Connected to server TX message (57 octets) ... TX message sent (61 / 61 octets) RawSocket handshake reply received RawSocket handshake reply is valid: start WAMP message send-receive loop RX preparing to receive message .. RX message (59 octets) ... RX message received. RX WAMP message: [2, 7090515283965860, {"roles"=>{"dealer"=>{"features"=>{"call_timeout"=>true}}, "broker"=>{}}}] RX preparing to receive message .. Session joined to realm with session ID 7090515283965860 TX message (30 octets) ... TX message sent (34 / 34 octets)

On bonefish server side, I got the following message: [root@wanzh02-usb-1 daemon]# ./bonefish --realm "default" --websocket-port 9999 --rawsocket-port 8888 --debu [rawsocket_server_impl.cpp:65][start] starting rawsocket server [tcp_listener.cpp:42][start_listening] starting tcp listener: 0.0.0.0:8888 [websocket_server_impl.cpp:53][start] starting websocket server: 0.0.0.0:9999 [wamp_message_processor.cpp:46][process_message] processing message: hello [wamp_router_impl.cpp:107][attach_session] attaching session: session [7090515283965860,default,none] [wamp_dealer.cpp:62][attach_session] attach session: session [7090515283965860,default,none] [wamp_broker.cpp:51][attach_session] attach session: session [7090515283965860,default,none] [wamp_router_impl.cpp:163][process_hello_message] session [7090515283965860,default,none], hello [default, {"roles"=>{"caller"=>{}, "callee"=>{}, "publisher"=>{}, "subscriber"=>{}}}] [wamp_router_impl.cpp:191][process_hello_message] session [7090515283965860,default,open], welcome [7090515283965860, {"roles"=>{"dealer"=>{"features"=>{"call_timeout"=>true}}, "broker"=>{}}}] [rawsocket_transport.cpp:39][send_message] sending message: welcome [wamp_message_processor.cpp:46][process_message] processing message: call [wamp_dealer.cpp:163][process_call_message] session [7090515283965860,default,open], call [1, {}, com.mathservice.add2, [23, 777], nil] [rawsocket_server_impl.cpp:224][on_message] unhandled exception: regex_error

jpetso commented 9 years ago

Oh right, regex support. I assume you're building with gcc 4.8, in which this StackOverflow question (and answer) seems applicable. In short, gcc 4.8 doesn't support std::regex, which is actually the original reason why we recommended 4.9 or higher.

We can choose between not accepting 4.8, or providing an alternative code path that uses boost::regex. Ideally, over time, old GCCs will disappear and everyone will be able to use std::regex freely without worries.

If you would like to have a shot at it, the code in question is located in src/bonefish/utility/wamp_uri.cpp.

davidchappelle commented 9 years ago

I wonder if it would just be best to just use boost::regex for the time being? What is the main advantage to using std::regex? Presumably std pulled its implementation from boost anyways.

ecorm commented 9 years ago

Please bear in mind that the latest long-term release version of Ubuntu (14.04) uses GCC 4.8.x. I use C+11 features extensively with GCC 4.8.x, and regex was the only feature so far I found lacking.

The downside of Boost.Regex is that it's not a header-only library.

Perhaps the best solution would be to write #ifdefs that fall back to Boost.Regex if the GCC version is less than 4.9.

allspace commented 9 years ago

Agree with ecorm. The latest Linux distributions today generally ship 4.8.x. I use CentOS. And RHEL/CentOS 7.x ships gcc 4.8.2.

So, supporting gcc 4.8.x will make compile easier.

jpetso commented 9 years ago

Submitted PR #10 to make this work. Please try if this works for you and report back, thanks!

allspace commented 9 years ago

Tested using gcc 4.8.4. It works.

Debug log is as below:

On client side:

Running on 105800 Starting ASIO I/O loop .. Connected to server TX message (57 octets) ... TX message sent (61 / 61 octets) RawSocket handshake reply received RawSocket handshake reply is valid: start WAMP message send-receive loop RX preparing to receive message .. RX message (59 octets) ... RX message received. RX WAMP message: [2, 7090515283965860, {"roles"=>{"dealer"=>{"features"=>{"call_timeout"=>true}}, "broker"=>{}}}] RX preparing to receive message .. Session joined to realm with session ID 7090515283965860 TX message (30 octets) ... TX message sent (34 / 34 octets) RX message (34 octets) ... RX message received. RX WAMP message: [8, 48, 1, {}, "wamp.error.no_such_procedure"] RX preparing to receive message .. TX message (26 octets) ... TX message sent (30 / 30 octets) RX message (30 octets) ... RX message received. RX WAMP message: [6, {}, "wamp.error.goodbye_and_out"] RX preparing to receive message ..Session left ( wamp.error.goodbye_and_out) ASIO I/O loop ended

On server side: [wamp_message_processor.cpp:46][process_message] processing message: hello [wamp_router_impl.cpp:107][attach_session] attaching session: session [7090515283965860,default,none] [wamp_dealer.cpp:62][attach_session] attach session: session [7090515283965860,default,none] [wamp_broker.cpp:51][attach_session] attach session: session [7090515283965860,default,none] [wamp_router_impl.cpp:163][process_hello_message] session [7090515283965860,default,none], hello [default, {"roles"=>{"caller"=>{}, "callee"=>{}, "publisher"=>{}, "subscriber"=>{}}}] [wamp_router_impl.cpp:191][process_hello_message] session [7090515283965860,default,open], welcome [7090515283965860, {"roles"=>{"dealer"=>{"features"=>{"call_timeout"=>true}}, "broker"=>{}}}] [rawsocket_transport.cpp:39][send_message] sending message: welcome [wamp_message_processor.cpp:46][process_message] processing message: call [wamp_dealer.cpp:163][process_call_message] session [7090515283965860,default,open], call [1, {}, com.mathservice.add2, [23, 777], nil] [wamp_dealer.cpp:454][send_error] error [call, 1, {}, wamp.error.no_such_procedure, nil, nil] [rawsocket_transport.cpp:39][send_message] sending message: error [wamp_message_processor.cpp:46][process_message] processing message: goodbye [wamp_router_impl.cpp:211][process_goodbye_message] session [7090515283965860,default,closed], goodbye [{}, wamp.error.close_realm] [rawsocket_transport.cpp:39][send_message] sending message: goodbye [wamp_dealer.cpp:79][detach_session] detach session: session [7090515283965860,default,closed] [wamp_dealer.cpp:84][detach_session] cleaning up session registrations [wamp_dealer.cpp:113][detach_session] cleaning up pending caller invocations [wamp_dealer.cpp:133][detach_session] cleaning up pending callee invocations [wamp_broker.cpp:66][detach_session] detach session: 0x1fcc2f8 [tcp_connection.cpp:189][handle_system_error] connection closed: asio.misc:2