You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Elad,
I found the reconnector will not be triggered when there is no OnError parameter in the subscription process .
public IWampRealmProxy Start(Dictionary<string, Action<IDictionary<string, ISerializedValue>>> subscribers)
{
var disposables = new List<IDisposable>();
Reconnector = new WampChannelReconnector(_channel, async () =>
{
await _channel.Open().ConfigureAwait(false);
disposables.ForEach(d => d.Dispose());
disposables.Clear();
foreach (var sub in subscribers)
{
var disposable = _channel.RealmProxy.Services.GetSubject(sub.Key).Subscribe(x =>
{
sub.Value?.Invoke(x.ArgumentsKeywords);
});
disposables.Add(disposable);
}
});
Reconnector.Start();
return _channel.RealmProxy;
}
I have to add OnError paramter in Subscribe method for the connector to run normally.
var disposable = _channel.RealmProxy.Services.GetSubject(sub.Key).Subscribe(x =>
{
sub.Value?.Invoke(x.ArgumentsKeywords);
}, e =>
{
Console.WriteLine(e.ToString());
});
I think the reconnector should not be affected.
And it caused another problem, the reconnection will be triggered when I actively close the channel.So I have to dispose the reconnector when the channel is closed ,to avoid duplicate subscriptions.
public async Task<GoodbyeMessage> Close(string reason = WampErrors.CloseNormal)
{
Reconnector.Dispose();
return await _channel.Close(reason, new GoodbyeDetails());
}
Is original design so or my code wrong?
Thanks
The text was updated successfully, but these errors were encountered:
Thanks.
Subscription is normal without OnError handle, but can't reconnect.
By the way,maybe it's time to update the document.There should be some recommended code to ensure it is robust and reliable.
Ok, this commit makes the System.WebSockets connection consistent with the WebSocket4Net connection, i.e. exceptions not handled by the user (such as the one you get if you don't subscribe to OnError) make their program crash. I'll release a new version to NuGet in the next following days.
Hi Elad,
I found the reconnector will not be triggered when there is no OnError parameter in the subscription process .
I have to add OnError paramter in Subscribe method for the connector to run normally.
I think the reconnector should not be affected.
And it caused another problem, the reconnection will be triggered when I actively close the channel.So I have to dispose the reconnector when the channel is closed ,to avoid duplicate subscriptions.
Is original design so or my code wrong?
Thanks
The text was updated successfully, but these errors were encountered: