Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WampSharp Monitor not sense router-side channel close #217

Closed
andeb91 opened this issue Oct 17, 2017 · 14 comments
Closed

WampSharp Monitor not sense router-side channel close #217

andeb91 opened this issue Oct 17, 2017 · 14 comments

Comments

@andeb91
Copy link

andeb91 commented Oct 17, 2017

The WampSharp monitor not sense the closure of the channel made router-side. Is there a way to sense it?
Thanks in advance.

@darkl
Copy link
Member

darkl commented Oct 17, 2017

What router?
What client implementation (WebSocket4Net/System.Net.WebSockets)?

@andeb91
Copy link
Author

andeb91 commented Oct 17, 2017

The router is Python-based. I'm developing a multiplatform application so the router is on Ubuntu with Python and the client on Android is based on jawampa.

@darkl
Copy link
Member

darkl commented Oct 17, 2017

The router is crossbario?
Can you attach a simple C# code that connects to the router and fails to detect disconnections?

@andeb91
Copy link
Author

andeb91 commented Oct 17, 2017

Yes, the router is crossbar.io implemented with autobahn-python.
The code that I use to connect is this:

` WampChannelFactory factory = new WampChannelFactory();
channel = factory.ConnectToRealm("MyRealm")
.WebSocketTransport("wss://10.0.0.101:8443/ws")
.SetSecurityOptions(options =>
{
options.EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls12;
})
.JsonSerialization()
.Build();

        channel.RealmProxy.Monitor.ConnectionBroken += OnConnectionBroken;
        channel.RealmProxy.Monitor.ConnectionError += OnConnectionError;
        channel.RealmProxy.Monitor.ConnectionEstablished += OnConnectionEstablished;

        Status.realmProxy = Status.channel.RealmProxy;

        Func<Task> connect = async () =>
        {
            await Status.channel.Open().ContinueWith(AfterChannelOpened).ConfigureAwait(false);
        };

        reconnector = new WampChannelReconnector(channel, connect);
        reconnector.Start();`

@darkl
Copy link
Member

darkl commented Oct 17, 2017

You are using the WebSocket4Net implementation. It automatically sends ping messages every 60 seconds by default. See here.

This mean that 60 seconds after the router gets down, WampSharp should detect this.

Elad

@andeb91
Copy link
Author

andeb91 commented Oct 17, 2017

Oh, I see. Thank you.
If I need less delay? For implementation reason I need to immediately react to the channel closure router-side. Jawampa give me the feedback immediately, is it possible to reach this also with WampSharp?

@darkl
Copy link
Member

darkl commented Oct 17, 2017

This will cost you by pinging the router every smaller interval. This can be achieved by providing you own WebSocket4NetFactory delegate to the first call.

factory.ConnectToRealm("MyRealm")
.WebSocketTransport(subprotocolName => new WebSocket("wss://10.0.0.101:8443/ws",subprotocolName)
{
    AutoSendPingInterval = 30
})
.SetSecurityOptions(options =>
{
    options.EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls12;
})
.JsonSerialization()
.Build();

@andeb91
Copy link
Author

andeb91 commented Oct 17, 2017

I've tryed this solution but it doesn't work. It still not sensing the channel closure router-side.

@darkl
Copy link
Member

darkl commented Oct 17, 2017 via email

@andeb91
Copy link
Author

andeb91 commented Oct 18, 2017

Yes, I also set AutoSendPingInterval to 1, but it doesn't work. I don't know why..

BTW, instead sensing the channel closure, can I sense the session killing router-side having also the killing reason? In other words can I have feedback on WampSharp client when the Autobahn-python router call all(u'wamp.session.kill', session, u'myreason', u'newuser')?

@darkl
Copy link
Member

darkl commented Oct 18, 2017

AutobahnPython is not a router, it is a client library. Your router is crossbario.
You could probably get those details in the ConnectionBroken event handler. There are some similar properties of this event handler event args.

Elad

@andeb91
Copy link
Author

andeb91 commented Oct 18, 2017

Ok, but there is however the problem that ConnectionBroken event is not raised. When on crossbar.io router I call wamp.session.kill, jawampa sense the session killing but WampSharp doesn't do that.
But now I immagine that never exists a solution for this problem, isn't it?

@darkl
Copy link
Member

darkl commented Oct 18, 2017

This should be solved with version 1.2.6.44-beta (released moments ago).

Elad

@andeb91
Copy link
Author

andeb91 commented Oct 18, 2017

Thanks a lot for this immediate fix; I very appreciate it!
I've already tested the new release and now it seems it works like expected!

Andrea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants