Skip to content

Commit debdcc7

Browse files
author
Max Presman
committed
strip out channel group if it's identical to channel
1 parent a411f5e commit debdcc7

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

‎src/main/java/com/pubnub/api/workers/SubscribeMessageWorker.java‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,21 +117,21 @@ private void processIncomingPayload(final SubscribeMessage message) {
117117
String subscriptionMatch = message.getSubscriptionMatch();
118118
PublishMetaData publishMetaData = message.getPublishMetaData();
119119

120-
if (channel.equals(subscriptionMatch)) {
120+
if (channel != null && channel.equals(subscriptionMatch)) {
121121
subscriptionMatch = null;
122122
}
123123

124124
if (message.getChannel().endsWith("-pnpres")) {
125125
PresenceEnvelope presencePayload = mapper.convertValue(message.getPayload(), PresenceEnvelope.class);
126126

127-
String associatedChannel = message.getChannel();
128-
String associatedSubscription = message.getSubscriptionMatch();
127+
String strippedPresenceChannel = null;
128+
String strippedPresenceSubscription = null;
129129

130-
if (associatedChannel != null) {
131-
associatedChannel = PubNubUtil.replaceLast(associatedChannel, "-pnpres", "");
130+
if (channel != null) {
131+
strippedPresenceChannel = PubNubUtil.replaceLast(channel, "-pnpres", "");
132132
}
133-
if (associatedSubscription != null) {
134-
associatedSubscription = PubNubUtil.replaceLast(associatedSubscription, "-pnpres", "");
133+
if (subscriptionMatch != null) {
134+
strippedPresenceSubscription = PubNubUtil.replaceLast(subscriptionMatch, "-pnpres", "");
135135
}
136136

137137
PNPresenceEventResult pnPresenceEventResult = PNPresenceEventResult.builder()
@@ -140,8 +140,8 @@ private void processIncomingPayload(final SubscribeMessage message) {
140140
.actualChannel((subscriptionMatch != null) ? channel : null)
141141
.subscribedChannel(subscriptionMatch != null ? subscriptionMatch : channel)
142142
// deprecated
143-
.channel(associatedChannel)
144-
.subscription(associatedSubscription)
143+
.channel(strippedPresenceChannel)
144+
.subscription(strippedPresenceSubscription)
145145
.state(presencePayload.getData())
146146
.timetoken(publishMetaData.getPublishTimetoken())
147147
.occupancy(presencePayload.getOccupancy())
@@ -163,8 +163,8 @@ private void processIncomingPayload(final SubscribeMessage message) {
163163
.actualChannel((subscriptionMatch != null) ? channel : null)
164164
.subscribedChannel(subscriptionMatch != null ? subscriptionMatch : channel)
165165
// deprecated
166-
.channel(message.getChannel())
167-
.subscription(message.getSubscriptionMatch())
166+
.channel(channel)
167+
.subscription(subscriptionMatch)
168168
.timetoken(publishMetaData.getPublishTimetoken())
169169
.build();
170170

0 commit comments

Comments
 (0)