Closed andeb91 closed 7 years ago
What router? What client implementation (WebSocket4Net/System.Net.WebSockets)?
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.
The router is crossbario? Can you attach a simple C# code that connects to the router and fails to detect disconnections?
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();`
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
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?
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();
I've tryed this solution but it doesn't work. It still not sensing the channel closure router-side.
Have you tried changing the AutoSendPingInterval value?
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')?
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
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?
This should be solved with version 1.2.6.44-beta (released moments ago).
Elad
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
The WampSharp monitor not sense the closure of the channel made router-side. Is there a way to sense it? Thanks in advance.