wampy.js icon indicating copy to clipboard operation
wampy.js copied to clipboard

not support route with parameter?

Open zhusheping opened this issue 5 years ago • 2 comments
trafficstars

I implemented a callee method with parameter routing with WampSharp like this:

            [WampProcedure("com.arguments.add2.{0}")]
            public Task< int> AddAsync2(int a, int b)
            {
                Console.WriteLine("add");
                return Task.FromResult( a + b);
            }

and i'm trying to call it in js with

var ws = new Wampy('ws://127.0.0.1:8804/',
            {
                autoReconnect: false, realm: 'realm',
                onConnect: () => {
                    console.log('Connected to Router!');
                    ws.call('com.arguments.add2.3', [3,4], /*When the callee started, it is 3*/
                        {
                            onSuccess: function (e) {
                                console.log('Reached success. Check Server side');
                            },
                            onError: function (e) {
                                console.log(e);
                            }
                        });
                }
            });

I get a error:"Topic URI doesn't meet requirements!".

And it's done with autobahn.js.

        var connection = new autobahn.Connection({ url: 'ws://127.0.0.1:8804/', realm: 'realm' });
        connection.onopen = function (session) {
            function onevent(args) {
                console.log("Event:", args[0]);
            }
            session.call('com.arguments.add2.3', [5,6]).then(
                function (res) {
                    console.log("Result:", res);
                }
            );
        };
        connection.open();

What shall I do?

zhusheping avatar Jul 21 '20 10:07 zhusheping

Hi @zhusheping ! Can you show full code? What version of wampy do you use? I can't reproduce it on latest version (6.2.2)

KSDaemon avatar Jul 21 '20 11:07 KSDaemon

zip 1.run the project "wampHost". 2.run a callee of project "wampCallee". 3.open index.html in project "wampCaller",the result 11 was logged. 4.open default.html in project "wampCaller","Topic URI doesn't meet requirements!" logged.

zhusheping avatar Jul 22 '20 01:07 zhusheping

Seems this is outdated... So closing for now. Please feel free to reopen if needed in case it is reproducible on the latest versions

KSDaemon avatar Dec 07 '22 20:12 KSDaemon