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

UnsubscribeAll Event #175

Merged
merged 6 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System.Collections.Generic;

namespace PubnubApi.PubnubEventEngine.Subscribe.Events {
public class SubscriptionChangedEvent : Core.IEvent {
public class UnsubscribeAllEvent : Core.IEvent {
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to pass channels or channel groups, unsubscribe all means we're setting both of those to empty arrays.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok..removed them.

public class SubscriptionChangedEvent : Core.IEvent {
public IEnumerable<string> Channels;
public IEnumerable<string> ChannelGroups;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ public override TransitionResult Transition(IEvent e)
{
return e switch
{
Events.UnsubscribeAllEvent unsubscribeAll => new UnsubscribedState()
{
},

Events.SubscriptionChangedEvent subscriptionChanged => new HandshakingState()
{
Channels = subscriptionChanged.Channels, ChannelGroups = subscriptionChanged.ChannelGroups,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public override TransitionResult Transition(IEvent e)
{
return e switch
{
Events.UnsubscribeAllEvent unsubscribeAll => new UnsubscribedState()
{
},

Events.SubscriptionChangedEvent subscriptionChanged => new HandshakingState()
{
Channels = subscriptionChanged.Channels, ChannelGroups = subscriptionChanged.ChannelGroups,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ public override TransitionResult Transition(IEvent e)
{
return e switch
{
Events.UnsubscribeAllEvent unsubscribeAll => new UnsubscribedState()
{
},

Events.SubscriptionChangedEvent subscriptionChanged => new HandshakingState()
{
Channels = subscriptionChanged.Channels, ChannelGroups = subscriptionChanged.ChannelGroups,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ public override TransitionResult Transition(IEvent e)
{
return e switch
{
Events.UnsubscribeAllEvent unsubscribeAll => new UnsubscribedState()
{
},

Events.SubscriptionChangedEvent subscriptionChanged => new States.HandshakingState()
{
Channels = subscriptionChanged.Channels, ChannelGroups = subscriptionChanged.ChannelGroups
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public override TransitionResult Transition(IEvent e)
{
return e switch
{
Events.UnsubscribeAllEvent unsubscribeAll => new UnsubscribedState()
{
},

Events.SubscriptionChangedEvent subscriptionChanged => new ReceivingState()
{
Channels = subscriptionChanged.Channels,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public override TransitionResult Transition(IEvent e)
{
return e switch
{
Events.UnsubscribeAllEvent unsubscribeAll => new UnsubscribedState()
{
},

Events.SubscriptionChangedEvent subscriptionChanged => new ReceivingState()
{
Channels = subscriptionChanged.Channels,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public override TransitionResult Transition(IEvent e)
{
return e switch
{
Events.UnsubscribeAllEvent unsubscribeAll => new UnsubscribedState()
{
},

Events.SubscriptionChangedEvent subscriptionChanged => new ReceivingState()
{
Channels = subscriptionChanged.Channels,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public override TransitionResult Transition(IEvent e)
{
return e switch
{
Events.UnsubscribeAllEvent unsubscribeAll => new UnsubscribedState()
{
},

Events.ReceiveSuccessEvent receiveSuccess => new ReceivingState()
{
Channels = receiveSuccess.Channels,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ namespace PubnubApi.PubnubEventEngine.Subscribe.States
{
internal class UnsubscribedState : Core.State
{
public override IEnumerable<IEffectInvocation> OnEntry { get; } = null;
public override IEnumerable<IEffectInvocation> OnExit { get; } = null;

public override TransitionResult Transition(Core.IEvent e)
{
return e switch
Expand Down