crossbario / autobahn-cpp

WAMP for C++ in Boost/Asio
https://crossbar.io/autobahn
Boost Software License 1.0
251 stars 104 forks source link

How to use same session for calling different remote procedure #196

Closed anandacs005 closed 5 years ago

anandacs005 commented 5 years ago

Environment Window 10 Crossbar io router

Problem Facing:

I want to maintain same session for calling different remote procedure as per request. Is there any sample available exampling how to maintain same session for multiple calls?

Can anybody please help me out on this?

oberstet commented 5 years ago

Just add 2 calls in sequence:

session->call("com.examples.calculator.add2", arguments, call_options).then(...);
session->call("com.examples.calculator.mul2", arguments, call_options).then(...);

https://github.com/crossbario/autobahn-cpp/blob/master/examples/caller.cpp#L104

when the 2nd call depends on the result from the 1st, the 2nd call needs to happen in the body of the 1st:

session->call("com.examples.calculator.add2", arguments, call_options).then(
...
    session->call("com.examples.calculator.mul2", arguments, call_options).then(...);
...
);