-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Allen Byron Penner
committed
Oct 5, 2018
1 parent
ff29d13
commit 420a84c
Showing
17 changed files
with
482 additions
and
479 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
namespace PurePusher | ||
{ | ||
public class Channel : EventEmitter | ||
{ | ||
private readonly PurePusherClient _purePusherClient; | ||
public string Name; | ||
public class Channel : EventEmitter | ||
{ | ||
private readonly PurePusherClient _purePusherClient; | ||
public string Name; | ||
|
||
public Channel(string channelName, PurePusherClient purePusherClient) | ||
{ | ||
_purePusherClient = purePusherClient; | ||
Name = channelName; | ||
} | ||
public Channel(string channelName, PurePusherClient purePusherClient) | ||
{ | ||
_purePusherClient = purePusherClient; | ||
Name = channelName; | ||
} | ||
|
||
public bool IsSubscribed { get; private set; } | ||
public bool IsSubscribed { get; private set; } | ||
|
||
public event SubscriptionEventHandler Subscribed; | ||
public event SubscriptionEventHandler Subscribed; | ||
|
||
internal virtual void SubscriptionSucceeded(string data) | ||
{ | ||
if (IsSubscribed) | ||
return; | ||
internal virtual void SubscriptionSucceeded(string data) | ||
{ | ||
if (IsSubscribed) | ||
return; | ||
|
||
IsSubscribed = true; | ||
IsSubscribed = true; | ||
|
||
Subscribed?.Invoke(this); | ||
} | ||
Subscribed?.Invoke(this); | ||
} | ||
|
||
public void Trigger(string eventName, object obj) => _purePusherClient?.Trigger(Name, eventName, obj); | ||
public void Trigger(string eventName, object obj) => _purePusherClient?.Trigger(Name, eventName, obj); | ||
|
||
public void Unsubscribe() | ||
{ | ||
IsSubscribed = false; | ||
_purePusherClient.Unsubscribe(Name); | ||
} | ||
} | ||
public void Unsubscribe() | ||
{ | ||
IsSubscribed = false; | ||
_purePusherClient.Unsubscribe(Name); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.