From 5bb34687a3719fc10e2d1316527233cb131323b1 Mon Sep 17 00:00:00 2001 From: Pandu Masabathula Date: Fri, 23 Jun 2023 18:30:27 +0530 Subject: [PATCH 1/6] HandshakeStoppedState transitions --- .../Subscribe/States/HandshakeStoppedState.cs | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/Api/PubnubApi/EventEngine/Subscribe/States/HandshakeStoppedState.cs b/src/Api/PubnubApi/EventEngine/Subscribe/States/HandshakeStoppedState.cs index 9774bc6cb..ca96c0e59 100644 --- a/src/Api/PubnubApi/EventEngine/Subscribe/States/HandshakeStoppedState.cs +++ b/src/Api/PubnubApi/EventEngine/Subscribe/States/HandshakeStoppedState.cs @@ -12,7 +12,49 @@ internal class HandshakeStoppedState : Core.IState { public IEnumerable OnEntry { get; } public IEnumerable OnExit { get; } public Tuple> Transition(IEvent e) { - throw new NotImplementedException(); + switch (e) { + case Events.SubscriptionChangedEvent subscriptionChanged: + return new Tuple>( + new HandshakingState() { + Channels = subscriptionChanged.Channels, + ChannelGroups = subscriptionChanged.ChannelGroups, + }, + new[] { + new HandshakeInvocation() { + Channels = subscriptionChanged.Channels, + ChannelGroups = subscriptionChanged.ChannelGroups, + }, + } + ); + case Events.ReconnectEvent reconnect: + return new Tuple>( + new HandshakingState() { + Channels = reconnect.Channels, + ChannelGroups = reconnect.ChannelGroups, + }, + new[] { + new HandshakeInvocation() { + Channels = reconnect.Channels, + ChannelGroups = reconnect.ChannelGroups, + }, + } + ); + case Events.SubscriptionRestoredEvent subscriptionRestored: + return new Tuple>( + new ReceivingState() { + Channels = subscriptionRestored.Channels, + ChannelGroups = subscriptionRestored.ChannelGroups + }, + new[] { + new ReceiveMessagesInvocation() { + Channels = subscriptionRestored.Channels, + ChannelGroups = subscriptionRestored.ChannelGroups, + }, + } + ); + + default: return null; + } } } } \ No newline at end of file From e03ef58ae625fec45cf46775e03e7cf28d0cb6cf Mon Sep 17 00:00:00 2001 From: Pandu Masabathula Date: Fri, 23 Jun 2023 18:40:05 +0530 Subject: [PATCH 2/6] ReceiveStoppedState and ReceiveFailedState transitions --- .../Subscribe/States/ReceiveFailedState.cs | 44 ++++++++++++++++++- .../Subscribe/States/ReceiveStoppedState.cs | 44 ++++++++++++++++++- 2 files changed, 86 insertions(+), 2 deletions(-) diff --git a/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveFailedState.cs b/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveFailedState.cs index 41c4be2ee..acd6251b4 100644 --- a/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveFailedState.cs +++ b/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveFailedState.cs @@ -12,7 +12,49 @@ internal class ReceiveFailedState : Core.IState { public IEnumerable OnEntry { get; } public IEnumerable OnExit { get; } public Tuple> Transition(IEvent e) { - throw new NotImplementedException(); + switch (e) { + case Events.SubscriptionChangedEvent subscriptionChanged: + return new Tuple>( + new ReceivingState() { + Channels = subscriptionChanged.Channels, + ChannelGroups = subscriptionChanged.ChannelGroups, + }, + new[] { + new ReceiveMessagesInvocation() { + Channels = subscriptionChanged.Channels, + ChannelGroups = subscriptionChanged.ChannelGroups, + }, + } + ); + case Events.ReconnectEvent reconnect: + return new Tuple>( + new ReceivingState() { + Channels = reconnect.Channels, + ChannelGroups = reconnect.ChannelGroups, + }, + new[] { + new ReceiveMessagesInvocation() { + Channels = reconnect.Channels, + ChannelGroups = reconnect.ChannelGroups, + }, + } + ); + case Events.SubscriptionRestoredEvent subscriptionRestored: + return new Tuple>( + new ReceivingState() { + Channels = subscriptionRestored.Channels, + ChannelGroups = subscriptionRestored.ChannelGroups + }, + new[] { + new ReceiveMessagesInvocation() { + Channels = subscriptionRestored.Channels, + ChannelGroups = subscriptionRestored.ChannelGroups, + }, + } + ); + + default: return null; + } } } } diff --git a/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveStoppedState.cs b/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveStoppedState.cs index 0d925e43e..33f1e9ae1 100644 --- a/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveStoppedState.cs +++ b/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveStoppedState.cs @@ -12,7 +12,49 @@ internal class ReceiveStoppedState : Core.IState { public IEnumerable OnEntry { get; } public IEnumerable OnExit { get; } public Tuple> Transition(IEvent e) { - throw new NotImplementedException(); + switch (e) { + case Events.SubscriptionChangedEvent subscriptionChanged: + return new Tuple>( + new ReceivingState() { + Channels = subscriptionChanged.Channels, + ChannelGroups = subscriptionChanged.ChannelGroups, + }, + new[] { + new ReceiveMessagesInvocation() { + Channels = subscriptionChanged.Channels, + ChannelGroups = subscriptionChanged.ChannelGroups, + }, + } + ); + case Events.ReconnectEvent reconnect: + return new Tuple>( + new ReceivingState() { + Channels = reconnect.Channels, + ChannelGroups = reconnect.ChannelGroups, + }, + new[] { + new ReceiveMessagesInvocation() { + Channels = reconnect.Channels, + ChannelGroups = reconnect.ChannelGroups, + }, + } + ); + case Events.SubscriptionRestoredEvent subscriptionRestored: + return new Tuple>( + new ReceivingState() { + Channels = subscriptionRestored.Channels, + ChannelGroups = subscriptionRestored.ChannelGroups + }, + new[] { + new ReceiveMessagesInvocation() { + Channels = subscriptionRestored.Channels, + ChannelGroups = subscriptionRestored.ChannelGroups, + }, + } + ); + + default: return null; + } } } } From 975084f7bbaaf01dd7231427cc12623e846a46d6 Mon Sep 17 00:00:00 2001 From: Pandu Masabathula Date: Fri, 23 Jun 2023 19:03:24 +0530 Subject: [PATCH 3/6] ReceivingState transitions --- .../Subscribe/Events/SubscriptionEvents.cs | 8 ++- .../Subscribe/States/ReceivingState.cs | 65 ++++++++++++++++++- 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/src/Api/PubnubApi/EventEngine/Subscribe/Events/SubscriptionEvents.cs b/src/Api/PubnubApi/EventEngine/Subscribe/Events/SubscriptionEvents.cs index e2a174173..419fec36e 100644 --- a/src/Api/PubnubApi/EventEngine/Subscribe/Events/SubscriptionEvents.cs +++ b/src/Api/PubnubApi/EventEngine/Subscribe/Events/SubscriptionEvents.cs @@ -40,11 +40,15 @@ public class HandshakeReconnectGiveUpEvent : Core.IEvent { } public class ReceiveSuccessEvent : Core.IEvent { - public List> messages; - public SubscriptionCursor cursor; + public IEnumerable Channels; + public IEnumerable ChannelGroups; + public List> Messages; + public SubscriptionCursor Cursor; } public class ReceiveFailureEvent : Core.IEvent { + public IEnumerable Channels; + public IEnumerable ChannelGroups; // TODO status or reason? public PNStatus status; } diff --git a/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceivingState.cs b/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceivingState.cs index 2208f539a..d2f58c57e 100644 --- a/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceivingState.cs +++ b/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceivingState.cs @@ -12,7 +12,70 @@ internal class ReceivingState : Core.IState { public IEnumerable OnEntry { get; } public IEnumerable OnExit { get; } public Tuple> Transition(IEvent e) { - throw new NotImplementedException(); + switch (e) { + case Events.ReceiveSuccessEvent receiveSuccess: + return new Tuple>( + new ReceivingState() { + Channels = receiveSuccess.Channels, + ChannelGroups = receiveSuccess.ChannelGroups + }, + new[] { + new ReceiveMessagesInvocation() { + Channels = receiveSuccess.Channels, + ChannelGroups = receiveSuccess.ChannelGroups, + }, + } + ); + case Events.SubscriptionChangedEvent subscriptionChanged: + return new Tuple>( + new ReceivingState() { + Channels = subscriptionChanged.Channels, + ChannelGroups = subscriptionChanged.ChannelGroups, + }, + new[] { + new ReceiveMessagesInvocation() { + Channels = subscriptionChanged.Channels, + ChannelGroups = subscriptionChanged.ChannelGroups, + }, + } + ); + case Events.SubscriptionRestoredEvent subscriptionRestored: + return new Tuple>( + new HandshakeFailedState() { + Channels = subscriptionRestored.Channels, + ChannelGroups = subscriptionRestored.ChannelGroups + }, + new[] { + new ReceiveMessagesInvocation() { + Channels = subscriptionRestored.Channels, + ChannelGroups = subscriptionRestored.ChannelGroups, + }, + } + ); + case Events.DisconnectEvent disconnect: + return new Tuple>( + new ReceiveStoppedState() { + Channels = disconnect.Channels, + ChannelGroups = disconnect.ChannelGroups + }, + new[] { + new EmitStatusInvocation() { + Channels = disconnect.Channels, + ChannelGroups = disconnect.ChannelGroups, + }, + } + ); + case Events.ReceiveFailureEvent receiveFailure: + return new Tuple>( + new ReceiveReconnectingState() { + Channels = receiveFailure.Channels, + ChannelGroups = receiveFailure.ChannelGroups + }, + null + ); + + default: return null; + } } } } From 5d9805cf4595ab414cbdf35042b042e3e25bb27c Mon Sep 17 00:00:00 2001 From: Pandu Masabathula Date: Fri, 23 Jun 2023 19:23:04 +0530 Subject: [PATCH 4/6] ReceiveReconnectState transitions --- .../Subscribe/Events/SubscriptionEvents.cs | 2 + .../Invocations/SubscriptionInvocations.cs | 7 +- .../States/ReceiveReconnectingState.cs | 84 ++++++++++++++++++- 3 files changed, 91 insertions(+), 2 deletions(-) diff --git a/src/Api/PubnubApi/EventEngine/Subscribe/Events/SubscriptionEvents.cs b/src/Api/PubnubApi/EventEngine/Subscribe/Events/SubscriptionEvents.cs index 419fec36e..27dd9b466 100644 --- a/src/Api/PubnubApi/EventEngine/Subscribe/Events/SubscriptionEvents.cs +++ b/src/Api/PubnubApi/EventEngine/Subscribe/Events/SubscriptionEvents.cs @@ -63,6 +63,8 @@ public class ReceiveReconnectFailureEvent : ReceiveFailureEvent { } public class ReceiveReconnectGiveUpEvent : Core.IEvent { + public IEnumerable Channels; + public IEnumerable ChannelGroups; // TODO status or reason? public PNStatus status; } diff --git a/src/Api/PubnubApi/EventEngine/Subscribe/Invocations/SubscriptionInvocations.cs b/src/Api/PubnubApi/EventEngine/Subscribe/Invocations/SubscriptionInvocations.cs index 39e615b2e..6638eb682 100644 --- a/src/Api/PubnubApi/EventEngine/Subscribe/Invocations/SubscriptionInvocations.cs +++ b/src/Api/PubnubApi/EventEngine/Subscribe/Invocations/SubscriptionInvocations.cs @@ -37,7 +37,12 @@ internal class HandshakeReconnectInvocation: Core.IEffectInvocation internal class CancelHandshakeReconnectInvocation: HandshakeReconnectInvocation, Core.IEffectCancelInvocation { } - internal class ReceiveReconnectInvocation: Core.IEffectInvocation { } + internal class ReceiveReconnectInvocation: Core.IEffectInvocation + { + public IEnumerable Channels; + public IEnumerable ChannelGroups; + } + internal class CancelReceiveReconnectInvocation: ReceiveReconnectInvocation, Core.IEffectCancelInvocation { } //internal class CancelReconnectInvocation : ReconnectInvocation, Core.IEffectCancelInvocation { } } \ No newline at end of file diff --git a/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveReconnectingState.cs b/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveReconnectingState.cs index 2a16d3c02..b56b9c4c8 100644 --- a/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveReconnectingState.cs +++ b/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveReconnectingState.cs @@ -12,7 +12,89 @@ internal class ReceiveReconnectingState : Core.IState { public IEnumerable OnEntry { get; } public IEnumerable OnExit { get; } public Tuple> Transition(IEvent e) { - throw new NotImplementedException(); + switch (e) { + case Events.SubscriptionChangedEvent subscriptionChanged: + return new Tuple>( + new ReceivingState() { + Channels = subscriptionChanged.Channels, + ChannelGroups = subscriptionChanged.ChannelGroups + }, + new[] { + new ReceiveMessagesInvocation() { + Channels = subscriptionChanged.Channels, + ChannelGroups = subscriptionChanged.ChannelGroups, + }, + } + ); + case Events.DisconnectEvent disconnect: + return new Tuple>( + new ReceiveStoppedState() { + Channels = disconnect.Channels, + ChannelGroups = disconnect.ChannelGroups + }, + new[] { + new EmitStatusInvocation() { + Channels = disconnect.Channels, + ChannelGroups = disconnect.ChannelGroups, + }, + } + ); + case Events.SubscriptionRestoredEvent subscriptionRestored: + return new Tuple>( + new ReceivingState() { + Channels = subscriptionRestored.Channels, + ChannelGroups = subscriptionRestored.ChannelGroups + }, + new[] { + new ReceiveMessagesInvocation() { + Channels = subscriptionRestored.Channels, + ChannelGroups = subscriptionRestored.ChannelGroups, + }, + } + ); + case Events.ReceiveReconnectSuccessEvent receiveReconnectSuccess: + return new Tuple>( + new ReceivingState() { + Channels = receiveReconnectSuccess.Channels, + ChannelGroups = receiveReconnectSuccess.ChannelGroups + }, + new IEffectInvocation[] { + new EmitStatusInvocation() { + Channels = receiveReconnectSuccess.Channels, + ChannelGroups = receiveReconnectSuccess.ChannelGroups, + }, + new ReceiveMessagesInvocation() { + Channels = receiveReconnectSuccess.Channels, + ChannelGroups = receiveReconnectSuccess.ChannelGroups, + } + } + ); + case Events.ReceiveReconnectFailureEvent receiveReconnectFailure: + return new Tuple>( + new ReceiveReconnectingState() { + Channels = receiveReconnectFailure.Channels, + ChannelGroups = receiveReconnectFailure.ChannelGroups + }, + new[] + { + new ReceiveReconnectInvocation() + { + Channels = receiveReconnectFailure.Channels, + ChannelGroups = receiveReconnectFailure.ChannelGroups, + } + } + ); + case Events.ReceiveReconnectGiveUpEvent receiveReconnectGiveUp: + return new Tuple>( + new ReceiveFailedState() { + Channels = receiveReconnectGiveUp.Channels, + ChannelGroups = receiveReconnectGiveUp.ChannelGroups + }, + null + ); + + default: return null; + } } } } From d059f86debcc8ca7e79a40b599595745ce6aae2a Mon Sep 17 00:00:00 2001 From: Pandu Masabathula Date: Mon, 26 Jun 2023 19:25:46 +0530 Subject: [PATCH 5/6] Added cursor --- .../Subscribe/Events/SubscriptionEvents.cs | 6 +++++ .../Invocations/SubscriptionInvocations.cs | 2 ++ .../Subscribe/States/HandshakeFailedState.cs | 5 +++- .../States/HandshakeReconnectingState.cs | 6 +++-- .../Subscribe/States/HandshakeStoppedState.cs | 3 ++- .../Subscribe/States/ReceiveFailedState.cs | 9 ++++++- .../States/ReceiveReconnectingState.cs | 27 +++++++++++++------ .../Subscribe/States/ReceiveStoppedState.cs | 10 ++++++- .../Subscribe/States/ReceivingState.cs | 17 +++++++++--- 9 files changed, 67 insertions(+), 18 deletions(-) diff --git a/src/Api/PubnubApi/EventEngine/Subscribe/Events/SubscriptionEvents.cs b/src/Api/PubnubApi/EventEngine/Subscribe/Events/SubscriptionEvents.cs index 27dd9b466..ff3688cce 100644 --- a/src/Api/PubnubApi/EventEngine/Subscribe/Events/SubscriptionEvents.cs +++ b/src/Api/PubnubApi/EventEngine/Subscribe/Events/SubscriptionEvents.cs @@ -4,6 +4,7 @@ namespace PubnubApi.PubnubEventEngine.Subscribe.Events { public class SubscriptionChangedEvent : Core.IEvent { public IEnumerable Channels; public IEnumerable ChannelGroups; + public SubscriptionCursor Cursor; } public class SubscriptionRestoredEvent : Core.IEvent { @@ -24,6 +25,7 @@ public class HandshakeFailureEvent : Core.IEvent { public class HandshakeReconnectSuccessEvent : HandshakeSuccessEvent { public IEnumerable Channels; public IEnumerable ChannelGroups; + public SubscriptionCursor Cursor; } public class HandshakeReconnectFailureEvent : HandshakeFailureEvent { @@ -49,6 +51,7 @@ public class ReceiveSuccessEvent : Core.IEvent { public class ReceiveFailureEvent : Core.IEvent { public IEnumerable Channels; public IEnumerable ChannelGroups; + public SubscriptionCursor Cursor; // TODO status or reason? public PNStatus status; } @@ -65,6 +68,7 @@ public class ReceiveReconnectFailureEvent : ReceiveFailureEvent { public class ReceiveReconnectGiveUpEvent : Core.IEvent { public IEnumerable Channels; public IEnumerable ChannelGroups; + public SubscriptionCursor Cursor; // TODO status or reason? public PNStatus status; } @@ -72,10 +76,12 @@ public class ReceiveReconnectGiveUpEvent : Core.IEvent { public class DisconnectEvent : Core.IEvent { public IEnumerable Channels; public IEnumerable ChannelGroups; + public SubscriptionCursor Cursor; } public class ReconnectEvent : Core.IEvent { public IEnumerable Channels; public IEnumerable ChannelGroups; + public SubscriptionCursor Cursor; } } \ No newline at end of file diff --git a/src/Api/PubnubApi/EventEngine/Subscribe/Invocations/SubscriptionInvocations.cs b/src/Api/PubnubApi/EventEngine/Subscribe/Invocations/SubscriptionInvocations.cs index 6638eb682..3ec6c133c 100644 --- a/src/Api/PubnubApi/EventEngine/Subscribe/Invocations/SubscriptionInvocations.cs +++ b/src/Api/PubnubApi/EventEngine/Subscribe/Invocations/SubscriptionInvocations.cs @@ -22,6 +22,7 @@ internal class ReceiveMessagesInvocation : Core.IEffectInvocation { public IEnumerable Channels; public IEnumerable ChannelGroups; + public SubscriptionCursor Cursor; } internal class CancelReceiveMessagesInvocation : ReceiveMessagesInvocation, Core.IEffectCancelInvocation { } @@ -41,6 +42,7 @@ internal class ReceiveReconnectInvocation: Core.IEffectInvocation { public IEnumerable Channels; public IEnumerable ChannelGroups; + public SubscriptionCursor Cursor; } internal class CancelReceiveReconnectInvocation: ReceiveReconnectInvocation, Core.IEffectCancelInvocation { } diff --git a/src/Api/PubnubApi/EventEngine/Subscribe/States/HandshakeFailedState.cs b/src/Api/PubnubApi/EventEngine/Subscribe/States/HandshakeFailedState.cs index 816d80fc2..8816c77db 100644 --- a/src/Api/PubnubApi/EventEngine/Subscribe/States/HandshakeFailedState.cs +++ b/src/Api/PubnubApi/EventEngine/Subscribe/States/HandshakeFailedState.cs @@ -8,6 +8,7 @@ internal class HandshakeFailedState : Core.IState { public IEnumerable Channels; public IEnumerable ChannelGroups; + public SubscriptionCursor Cursor; public IEnumerable OnEntry { get; } public IEnumerable OnExit { get; } @@ -43,12 +44,14 @@ internal class HandshakeFailedState : Core.IState { return new Tuple>( new ReceivingState() { Channels = subscriptionRestored.Channels, - ChannelGroups = subscriptionRestored.ChannelGroups + ChannelGroups = subscriptionRestored.ChannelGroups, + Cursor = subscriptionRestored.Cursor }, new[] { new ReceiveMessagesInvocation() { Channels = subscriptionRestored.Channels, ChannelGroups = subscriptionRestored.ChannelGroups, + Cursor = subscriptionRestored.Cursor }, } ); diff --git a/src/Api/PubnubApi/EventEngine/Subscribe/States/HandshakeReconnectingState.cs b/src/Api/PubnubApi/EventEngine/Subscribe/States/HandshakeReconnectingState.cs index 26aba2e9c..db5f59d88 100644 --- a/src/Api/PubnubApi/EventEngine/Subscribe/States/HandshakeReconnectingState.cs +++ b/src/Api/PubnubApi/EventEngine/Subscribe/States/HandshakeReconnectingState.cs @@ -46,7 +46,8 @@ internal class HandshakeReconnectingState : Core.IState { return new Tuple>( new ReceivingState() { Channels = handshakeReconnectSuccess.Channels, - ChannelGroups = handshakeReconnectSuccess.ChannelGroups + ChannelGroups = handshakeReconnectSuccess.ChannelGroups, + Cursor = handshakeReconnectSuccess.Cursor }, new[] { new EmitStatusInvocation() { @@ -59,7 +60,8 @@ internal class HandshakeReconnectingState : Core.IState { return new Tuple>( new HandshakeFailedState() { Channels = subscriptionRestored.Channels, - ChannelGroups = subscriptionRestored.ChannelGroups + ChannelGroups = subscriptionRestored.ChannelGroups, + Cursor = subscriptionRestored.Cursor }, null ); diff --git a/src/Api/PubnubApi/EventEngine/Subscribe/States/HandshakeStoppedState.cs b/src/Api/PubnubApi/EventEngine/Subscribe/States/HandshakeStoppedState.cs index ca96c0e59..885acc5a8 100644 --- a/src/Api/PubnubApi/EventEngine/Subscribe/States/HandshakeStoppedState.cs +++ b/src/Api/PubnubApi/EventEngine/Subscribe/States/HandshakeStoppedState.cs @@ -43,7 +43,8 @@ internal class HandshakeStoppedState : Core.IState { return new Tuple>( new ReceivingState() { Channels = subscriptionRestored.Channels, - ChannelGroups = subscriptionRestored.ChannelGroups + ChannelGroups = subscriptionRestored.ChannelGroups, + Cursor = subscriptionRestored.Cursor }, new[] { new ReceiveMessagesInvocation() { diff --git a/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveFailedState.cs b/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveFailedState.cs index acd6251b4..8b3b68489 100644 --- a/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveFailedState.cs +++ b/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveFailedState.cs @@ -8,6 +8,7 @@ internal class ReceiveFailedState : Core.IState { public IEnumerable Channels; public IEnumerable ChannelGroups; + public SubscriptionCursor Cursor; public IEnumerable OnEntry { get; } public IEnumerable OnExit { get; } @@ -18,11 +19,13 @@ internal class ReceiveFailedState : Core.IState { new ReceivingState() { Channels = subscriptionChanged.Channels, ChannelGroups = subscriptionChanged.ChannelGroups, + Cursor = subscriptionChanged.Cursor }, new[] { new ReceiveMessagesInvocation() { Channels = subscriptionChanged.Channels, ChannelGroups = subscriptionChanged.ChannelGroups, + Cursor = subscriptionChanged.Cursor }, } ); @@ -31,11 +34,13 @@ internal class ReceiveFailedState : Core.IState { new ReceivingState() { Channels = reconnect.Channels, ChannelGroups = reconnect.ChannelGroups, + Cursor = reconnect.Cursor }, new[] { new ReceiveMessagesInvocation() { Channels = reconnect.Channels, ChannelGroups = reconnect.ChannelGroups, + Cursor = reconnect.Cursor }, } ); @@ -43,12 +48,14 @@ internal class ReceiveFailedState : Core.IState { return new Tuple>( new ReceivingState() { Channels = subscriptionRestored.Channels, - ChannelGroups = subscriptionRestored.ChannelGroups + ChannelGroups = subscriptionRestored.ChannelGroups, + Cursor = subscriptionRestored.Cursor }, new[] { new ReceiveMessagesInvocation() { Channels = subscriptionRestored.Channels, ChannelGroups = subscriptionRestored.ChannelGroups, + Cursor = subscriptionRestored.Cursor }, } ); diff --git a/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveReconnectingState.cs b/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveReconnectingState.cs index b56b9c4c8..d18036c5a 100644 --- a/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveReconnectingState.cs +++ b/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveReconnectingState.cs @@ -8,6 +8,7 @@ internal class ReceiveReconnectingState : Core.IState { public IEnumerable Channels; public IEnumerable ChannelGroups; + public SubscriptionCursor Cursor; public IEnumerable OnEntry { get; } public IEnumerable OnExit { get; } @@ -17,12 +18,14 @@ internal class ReceiveReconnectingState : Core.IState { return new Tuple>( new ReceivingState() { Channels = subscriptionChanged.Channels, - ChannelGroups = subscriptionChanged.ChannelGroups + ChannelGroups = subscriptionChanged.ChannelGroups, + Cursor = subscriptionChanged.Cursor }, new[] { new ReceiveMessagesInvocation() { Channels = subscriptionChanged.Channels, ChannelGroups = subscriptionChanged.ChannelGroups, + Cursor = subscriptionChanged.Cursor }, } ); @@ -30,7 +33,8 @@ internal class ReceiveReconnectingState : Core.IState { return new Tuple>( new ReceiveStoppedState() { Channels = disconnect.Channels, - ChannelGroups = disconnect.ChannelGroups + ChannelGroups = disconnect.ChannelGroups, + Cursor = disconnect.Cursor }, new[] { new EmitStatusInvocation() { @@ -43,12 +47,14 @@ internal class ReceiveReconnectingState : Core.IState { return new Tuple>( new ReceivingState() { Channels = subscriptionRestored.Channels, - ChannelGroups = subscriptionRestored.ChannelGroups + ChannelGroups = subscriptionRestored.ChannelGroups, + Cursor = subscriptionRestored.Cursor }, new[] { new ReceiveMessagesInvocation() { Channels = subscriptionRestored.Channels, ChannelGroups = subscriptionRestored.ChannelGroups, + Cursor = subscriptionRestored.Cursor }, } ); @@ -56,7 +62,8 @@ internal class ReceiveReconnectingState : Core.IState { return new Tuple>( new ReceivingState() { Channels = receiveReconnectSuccess.Channels, - ChannelGroups = receiveReconnectSuccess.ChannelGroups + ChannelGroups = receiveReconnectSuccess.ChannelGroups, + Cursor = receiveReconnectSuccess.Cursor }, new IEffectInvocation[] { new EmitStatusInvocation() { @@ -66,6 +73,7 @@ internal class ReceiveReconnectingState : Core.IState { new ReceiveMessagesInvocation() { Channels = receiveReconnectSuccess.Channels, ChannelGroups = receiveReconnectSuccess.ChannelGroups, + Cursor = receiveReconnectSuccess.Cursor } } ); @@ -73,14 +81,16 @@ internal class ReceiveReconnectingState : Core.IState { return new Tuple>( new ReceiveReconnectingState() { Channels = receiveReconnectFailure.Channels, - ChannelGroups = receiveReconnectFailure.ChannelGroups + ChannelGroups = receiveReconnectFailure.ChannelGroups, + Cursor = receiveReconnectFailure.Cursor }, new[] - { - new ReceiveReconnectInvocation() + { + new ReceiveReconnectInvocation { Channels = receiveReconnectFailure.Channels, ChannelGroups = receiveReconnectFailure.ChannelGroups, + Cursor = receiveReconnectFailure.Cursor } } ); @@ -88,7 +98,8 @@ internal class ReceiveReconnectingState : Core.IState { return new Tuple>( new ReceiveFailedState() { Channels = receiveReconnectGiveUp.Channels, - ChannelGroups = receiveReconnectGiveUp.ChannelGroups + ChannelGroups = receiveReconnectGiveUp.ChannelGroups, + Cursor = receiveReconnectGiveUp.Cursor }, null ); diff --git a/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveStoppedState.cs b/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveStoppedState.cs index 33f1e9ae1..a66411b36 100644 --- a/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveStoppedState.cs +++ b/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceiveStoppedState.cs @@ -8,6 +8,8 @@ internal class ReceiveStoppedState : Core.IState { public IEnumerable Channels; public IEnumerable ChannelGroups; + public SubscriptionCursor Cursor; + public IEnumerable OnEntry { get; } public IEnumerable OnExit { get; } @@ -18,11 +20,13 @@ internal class ReceiveStoppedState : Core.IState { new ReceivingState() { Channels = subscriptionChanged.Channels, ChannelGroups = subscriptionChanged.ChannelGroups, + Cursor = subscriptionChanged.Cursor, }, new[] { new ReceiveMessagesInvocation() { Channels = subscriptionChanged.Channels, ChannelGroups = subscriptionChanged.ChannelGroups, + Cursor = subscriptionChanged.Cursor, }, } ); @@ -31,11 +35,13 @@ internal class ReceiveStoppedState : Core.IState { new ReceivingState() { Channels = reconnect.Channels, ChannelGroups = reconnect.ChannelGroups, + Cursor = reconnect.Cursor }, new[] { new ReceiveMessagesInvocation() { Channels = reconnect.Channels, ChannelGroups = reconnect.ChannelGroups, + Cursor = reconnect.Cursor }, } ); @@ -43,12 +49,14 @@ internal class ReceiveStoppedState : Core.IState { return new Tuple>( new ReceivingState() { Channels = subscriptionRestored.Channels, - ChannelGroups = subscriptionRestored.ChannelGroups + ChannelGroups = subscriptionRestored.ChannelGroups, + Cursor = subscriptionRestored.Cursor }, new[] { new ReceiveMessagesInvocation() { Channels = subscriptionRestored.Channels, ChannelGroups = subscriptionRestored.ChannelGroups, + Cursor = subscriptionRestored.Cursor }, } ); diff --git a/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceivingState.cs b/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceivingState.cs index d2f58c57e..ac5aebd22 100644 --- a/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceivingState.cs +++ b/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceivingState.cs @@ -8,6 +8,7 @@ internal class ReceivingState : Core.IState { public IEnumerable Channels; public IEnumerable ChannelGroups; + public SubscriptionCursor Cursor; public IEnumerable OnEntry { get; } public IEnumerable OnExit { get; } @@ -17,12 +18,14 @@ internal class ReceivingState : Core.IState { return new Tuple>( new ReceivingState() { Channels = receiveSuccess.Channels, - ChannelGroups = receiveSuccess.ChannelGroups + ChannelGroups = receiveSuccess.ChannelGroups, + Cursor = receiveSuccess.Cursor }, new[] { new ReceiveMessagesInvocation() { Channels = receiveSuccess.Channels, ChannelGroups = receiveSuccess.ChannelGroups, + Cursor = receiveSuccess.Cursor }, } ); @@ -31,11 +34,13 @@ internal class ReceivingState : Core.IState { new ReceivingState() { Channels = subscriptionChanged.Channels, ChannelGroups = subscriptionChanged.ChannelGroups, + Cursor = subscriptionChanged.Cursor }, new[] { new ReceiveMessagesInvocation() { Channels = subscriptionChanged.Channels, ChannelGroups = subscriptionChanged.ChannelGroups, + Cursor = subscriptionChanged.Cursor }, } ); @@ -43,12 +48,14 @@ internal class ReceivingState : Core.IState { return new Tuple>( new HandshakeFailedState() { Channels = subscriptionRestored.Channels, - ChannelGroups = subscriptionRestored.ChannelGroups + ChannelGroups = subscriptionRestored.ChannelGroups, + Cursor = subscriptionRestored.Cursor }, new[] { new ReceiveMessagesInvocation() { Channels = subscriptionRestored.Channels, ChannelGroups = subscriptionRestored.ChannelGroups, + Cursor = subscriptionRestored.Cursor }, } ); @@ -56,7 +63,8 @@ internal class ReceivingState : Core.IState { return new Tuple>( new ReceiveStoppedState() { Channels = disconnect.Channels, - ChannelGroups = disconnect.ChannelGroups + ChannelGroups = disconnect.ChannelGroups, + Cursor = disconnect.Cursor }, new[] { new EmitStatusInvocation() { @@ -69,7 +77,8 @@ internal class ReceivingState : Core.IState { return new Tuple>( new ReceiveReconnectingState() { Channels = receiveFailure.Channels, - ChannelGroups = receiveFailure.ChannelGroups + ChannelGroups = receiveFailure.ChannelGroups, + Cursor = receiveFailure.Cursor }, null ); From 11ddeb47f04da749f45904e7d3ff07f3b800a52d Mon Sep 17 00:00:00 2001 From: Pandu Masabathula Date: Mon, 26 Jun 2023 20:25:29 +0530 Subject: [PATCH 6/6] typo fix --- .../PubnubApi/EventEngine/Subscribe/States/ReceivingState.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceivingState.cs b/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceivingState.cs index ac5aebd22..06bee3d54 100644 --- a/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceivingState.cs +++ b/src/Api/PubnubApi/EventEngine/Subscribe/States/ReceivingState.cs @@ -46,7 +46,7 @@ internal class ReceivingState : Core.IState { ); case Events.SubscriptionRestoredEvent subscriptionRestored: return new Tuple>( - new HandshakeFailedState() { + new ReceivingState() { Channels = subscriptionRestored.Channels, ChannelGroups = subscriptionRestored.ChannelGroups, Cursor = subscriptionRestored.Cursor