public static void SetSubscribeUnsubscribeErrorObserver(this ISubscriptionEventSource source, IObservableSink <string> observer) { source.OnSubscribeError += (_, exn) => { if (exn is PduException) { var pduExn = (PduException)exn; observer.Next($"rtm:subscribe-error:{exn.GetType().Name}:{pduExn.Error?.Code}"); } else { observer.Next($"rtm:subscribe-error:{exn.GetType().Name}"); } }; source.OnUnsubscribeError += (_, exn) => { if (exn is PduException) { var pduExn = (PduException)exn; observer.Next($"rtm:unsubscribe-error:{exn.GetType().Name}:{pduExn.Error?.Code}"); } else { observer.Next($"rtm:unsubscribe-error:{exn.GetType().Name}"); } }; }
public static void SetStateObserver(this IRtmClient client, IObservableSink <string> observer) { client.OnEnterStopped += () => { observer.Next("enter-stopped"); }; client.OnLeaveStopped += () => { observer.Next("leave-stopped"); }; client.OnEnterConnecting += () => { observer.Next("enter-connecting"); }; client.OnLeaveConnecting += () => { observer.Next("leave-connecting"); }; client.OnEnterConnected += (_) => { observer.Next("enter-connected"); }; client.OnLeaveConnected += (_) => { observer.Next("leave-connected"); }; client.OnEnterAwaiting += () => { observer.Next("enter-awaiting"); }; client.OnLeaveAwaiting += () => { observer.Next("leave-awaiting"); }; client.OnEnterDisposed += () => { observer.Next("enter-disposed"); }; }
public static void SetSubscriptionDataQueue( this ISubscriptionEventSource source, IObservableSink <RtmSubscriptionData> observer) { source.OnSubscriptionData += (_, data) => { observer.Next(data); }; }
public static void SetSubscriptionPduObserver(this ISubscriptionEventSource source, IObservableSink <string> observer) { source.OnSubscriptionData += (_, pdu) => { foreach (var m in pdu.Messages) { observer.Next($"rtm:subscription-data:{m?.ToString()}"); } }; source.OnSubscriptionInfo += (_, pdu) => { observer.Next($"rtm:subscription-info:{pdu.Info}"); }; source.OnSubscriptionError += (_, pdu) => { observer.Next($"rtm:subscription-error:{pdu.Code}"); }; }
public static void SetSubscriptionStateObserver(this ISubscriptionEventSource source, IObservableSink <string> observer) { source.OnCreated += (_) => { observer.Next("rtm:created"); }; source.OnEnterUnsubscribed += (_) => { observer.Next("rtm:enter-unsubscribed"); }; source.OnLeaveUnsubscribed += (_) => { observer.Next("rtm:leave-unsubscribed"); }; source.OnEnterSubscribing += (_, r) => { observer.Next("rtm:enter-subscribing"); }; source.OnLeaveSubscribing += (_) => { observer.Next("rtm:leave-subscribing"); }; source.OnEnterSubscribed += (_) => { observer.Next("rtm:enter-subscribed"); }; source.OnLeaveSubscribed += (_) => { observer.Next("rtm:leave-subscribed"); }; source.OnEnterUnsubscribing += (_) => { observer.Next("rtm:enter-unsubscribing"); }; source.OnLeaveUnsubscribing += (_) => { observer.Next("rtm:leave-unsubscribing"); }; source.OnDeleted += (_) => { observer.Next("rtm:deleted"); }; source.OnEnterFailed += (_) => { observer.Next("rtm:enter-failed"); }; source.OnLeaveFailed += (_) => { observer.Next("rtm:leave-failed"); }; }
public static void SetClientErrorObserver(this IRtmClient client, IObservableSink <string> observer) { client.OnError += ex => { observer.Next("error:" + ex.GetType().Name); }; }