Skip to content

Commit a74fd15

Browse files
committed
add hasChannel(), hasSubscriptionOf()
1 parent 921659b commit a74fd15

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/main/java/com/hosopy/actioncable/Channel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void addParam(String key, JsonElement value) {
7676
addParamInternal(key, value);
7777
}
7878

79-
/*package*/ String toIdentifier() {
79+
public String toIdentifier() {
8080
synchronized (params) {
8181
if (identifier == null) {
8282
identifier = GSON.toJson(params);

src/main/java/com/hosopy/actioncable/Consumer.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,19 @@ public void setStaleThresholdInSecond(int staleThresholdInSecond){
127127
if(connectionMonitor !=null) connectionMonitor.setStaleThresholdInSecond(staleThresholdInSecond);
128128
}
129129

130+
@Deprecated
130131
public boolean hasSubscription(String channel) {
131132
return subscriptions != null && subscriptions.hasSubscription(channel);
132133
}
133134

135+
public boolean hasChannel(String channel) {
136+
return subscriptions != null && subscriptions.hasChannel(channel);
137+
}
138+
139+
public boolean hasSubscriptionFor(String identifier) {
140+
return subscriptions != null && subscriptions.hasSubscriptionOf(identifier);
141+
}
142+
134143
public Connection getConnection() {
135144
return connection;
136145
}

0 commit comments

Comments
 (0)