Giter Club home page Giter Club logo

wampire's People

Contributors

dudochkin-victor avatar frol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

wampire's Issues

Example endpoint does not handle argument types correctly

Running endpoint example and api_user example, the addition example is not able to parse it's arguments correctly.

Enter a command (or type "help")
add 10,10
Error: CallError { reason: InvalidArgument, args: Some([String("Expected integer, got 10")]), kwargs: None }

No "options" parameter provided in the client call function

https://github.com/ohyo-io/wampire/blob/a901df4fa4dde4a11770f2ac7caa5ea5bff5a81c/src/client.rs#L1052C12-L1052C12

pub fn call(
    &mut self,
    procedure: URI,
    args: Option<List>,
    kwargs: Option<Dict>,
) -> Pin<Box<dyn Future<Output = Result<(List, Dict), CallError>>>> {
    info!("Calling {:?} with {:?} | {:?}", procedure, args, kwargs);

    let request_id = self.get_next_session_id();

    let (complete, receiver) = oneshot::channel();

    let mut info = self.connection_info.lock().unwrap();

    info.call_requests.insert(request_id, complete);

    info.send_message(Message::Call(
        request_id,
        CallOptions::new(),
        procedure,
        args,
        kwargs,
    ))
    .unwrap();

    Box::pin(async {
        receiver.await.unwrap_or(Err(CallError {
            reason: Reason::InternalError,
            args: None,
            kwargs: None,
        }))
    })
}

Why is there a blank call option in info.send_message() ?

example for wamp cra?

The wiki page about authentication has only broken links, I'm unable to find an example to use wampcra.

I get:

Router aborted connection.  Reason: CustomReason(URI { uri: "wamp.error.no_auth_method" })

[BUG] IDs can be larger than 2^53

Describe the bug
Received errors like invalid value 66856894559470078 for ID or received yield for call that was not send while playing with your great crate ;) Digged a little bit in and found that you're using rng.gen_range(0..1u64.rotate_left(56) - 1) wich is lager than the definition for IDs from https://wamp-proto.org/wamp_latest_ietf.html#name-ids ( 1 to 2^53 inclusive )

changing it to rng.gen_range(1..1u64.rotate_left(53)) solved all errors with all different WAMP implementations i've tested (python, js, ts, ... ) ;)

To Reproduce
created a simple router in rust:

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();
    info!("start");
  
    tokio::spawn(async move {
        let mut router = Router::new();
        router.add_realm("ca.test");
        
        router.listen("127.0.0.1:12345").join();
       
        println!("router ende");
    });
    println!("Press enter to quit");
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    Ok(())
}

tested with a simple python script (registering a function and calling it)


#from autobahn.twisted.wamp import ApplicationSession
from autobahn.asyncio.wamp import ApplicationSession, ApplicationRunner
import asyncio
class MyComponent(ApplicationSession):


    async def onJoin(self, details):
        print(details)
        # 3. register a procedure for remote calling
        def add2(x, y):
            return x + y

        await self.register(add2, 'ca.test.add2')

        # 4. call a remote procedure
       
        while True:
            res = await self.call('ca.test.add2', 2, 3)
            print("Got result: {}".format(res))
            await asyncio.sleep(1)
        #self.leave()

    def onDisconnect(self):
        asyncio.get_event_loop().stop()

if __name__ == "__main__":
    print("starte")
    runner = ApplicationRunner("ws://127.0.0.1:12345","ca.test")
    runner.run(MyComponent)

resulted in (Python)

    raise ProtocolError("{0}: invalid value {1} for ID".format(message, value))
autobahn.wamp.exception.ProtocolError: 'registration' in REGISTERED: invalid value 66856894559470078 for ID

Version Information
pulled 0.2.1 from cargo

Panic when client connects to host which is not listenning

The call to connect() ends up calling unwrap() which makes the program panic.

Client code :

let mut client = match connection.connect() {
        Ok(c) => c,
        Err(e) => {
            return Err(ProjectError::ConnectionFailed(format!("{}",e)))
        },
    };

Log output

[2019-12-26T20:05:13Z ERROR ws::handler] WS Error <Io(Os { code: 10061, kind: ConnectionRefused, message: "No connection could be made because the target machine actively refused it." })>
[2019-12-26T20:05:13Z TRACE ws::io] WebSocket connection to token=Token(0) disconnected.
[2019-12-26T20:05:13Z TRACE ws::io] Active connections 0
[2019-12-26T20:05:13Z DEBUG ws::io] Shutting down websocket client.
[2019-12-26T20:05:13Z DEBUG ws::factory] Factory received WebSocket shutdown request.
[2019-12-26T20:05:13Z TRACE mio::poll] deregistering handle with poller
[2019-12-26T20:05:13Z TRACE mio::poll] deregistering handle with poller
[2019-12-26T20:05:13Z TRACE mio::poll] deregistering handle with poller
[2019-12-26T20:05:13Z DEBUG wampire::client] Result of connection: Ok(())
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', src\libcore\result.rs:1165:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.