Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
89a8438
Ensure ListenerManager listeners are synchronized
Nov 13, 2017
c2c41af
Upgrade Gson library to 2.8.2
Nov 13, 2017
74cd914
Merge pull request #83 from lennykano/synchronized-listeners
MaxPresman Nov 14, 2017
c6bb4db
Merge pull request #84 from qsoftdevelopment/bugfix/UpgradeGson
MaxPresman Nov 14, 2017
a2e82e4
Bump version to 4.15.0
Nov 15, 2017
cb8cc69
Bump version to 4.15.0
Nov 15, 2017
dfe0552
Merge pull request #86 from qsoftdevelopment/feature/Release_4.15.0
qsoftdevelopment Nov 15, 2017
c143e5c
Add new checkstyle.xml file
Nov 15, 2017
68c3fdb
Merge pull request #88 from qsoftdevelopment/feature/Release_4.15.0
qsoftdevelopment Nov 15, 2017
94c2509
Update tests for 4.15.0
Nov 16, 2017
c5da0d4
Downgrade checkstyle for Java 7
Nov 16, 2017
a6c7d08
Add Javadoc for 4.15.0
Nov 16, 2017
b56eac7
Merge pull request #90 from qsoftdevelopment/feature/Release_4.15.0
qsoftdevelopment Nov 16, 2017
b7a0701
Fix a bug where TelemetryManager prevented PubNub from destroying
Nov 16, 2017
0c43e44
Merge pull request #93 from qsoftdevelopment/bugfix/ShutdownJvm-FD941
qsoftdevelopment Nov 16, 2017
52a11c7
Fix Codacy complaints (#95)
qsoftdevelopment Nov 16, 2017
4f501d4
Delete test (#97)
qsoftdevelopment Nov 17, 2017
ff0f4b8
Merge branch 'master' into develop
qsoftdevelopment Nov 17, 2017
ac18c57
Bugfix for yaml (#98)
qsoftdevelopment Nov 17, 2017
877302a
Merge branch 'master' into develop
qsoftdevelopment Nov 17, 2017
6e85f42
fix up maximum conenctions
Nov 20, 2017
f8668bb
Merge branch 'fix_up_maximum_connections' into develop
Nov 20, 2017
03b1048
docs changes
Nov 20, 2017
aeff65c
bump version
Nov 20, 2017
a2eb8a0
changelog w/ dates
Nov 22, 2017
97ca810
Merge branch 'master' into develop
qsoftdevelopment Nov 24, 2017
44dd4f3
Add heartbeat feature with no subscription
Dec 15, 2017
d5ac8d2
4.17.0
Dec 19, 2017
486f9b5
docs for presence operation
Dec 19, 2017
95eccb9
Add heartbeat feature with no subscription (#103)
qsoftdevelopment Dec 21, 2017
1ffcbe9
Merge branch 'master' into develop
qsoftdevelopment Dec 21, 2017
00d2e64
Update OkHttp dependency (#105)
qsoftdevelopment Dec 21, 2017
03c9422
Fix codacy complaints (#106)
qsoftdevelopment Dec 21, 2017
015b783
Fix more tests for Codacy (#107)
qsoftdevelopment Dec 21, 2017
5cafdf3
Update OkHttp version (#110)
qsoftdevelopment Jan 11, 2018
96678a9
Merge branch 'master' into develop
qsoftdevelopment Jan 11, 2018
b906532
4.18.0
Jan 12, 2018
f220db1
Merge branch 'master' into develop
qsoftdevelopment Jan 12, 2018
da43581
Update pubnub-yml (#113)
qsoftdevelopment Jan 18, 2018
cd0c2a2
Update latest release date (#118)
qsoftdevelopment Mar 22, 2018
117b5f9
Merge branch 'master' into develop
qsoftdevelopment Mar 22, 2018
93593be
Fix an issue where end of channel history was interpreted as an error…
qsoftdevelopment Mar 26, 2018
12a037f
Merge branch 'master' into develop
qsoftdevelopment Mar 26, 2018
43b4540
Qsoftdevelopment fixversion1.19.0 (#122)
qsoftdevelopment Mar 29, 2018
9ba6443
Merge branch 'master' into develop
qsoftdevelopment Mar 29, 2018
1a36d37
Fix a bug where the global-here-now response was interpreted incorrec…
qsoftdevelopment May 25, 2018
40be212
Merge branch 'master' into develop
qsoftdevelopment May 28, 2018
7c80ec8
Update .travis.yml
qsoftdevelopment May 31, 2018
ebeeb6a
Release 4.20.0 (#126)
qsoftdevelopment Aug 14, 2018
aa16edf
Merge branch 'master' into develop
qsoftdevelopment Aug 14, 2018
a3071e9
Update for the new release (#128)
qsoftdevelopment Aug 28, 2018
e7cac86
Merge branch 'master' into develop
qsoftdevelopment Sep 3, 2018
1109771
Add ability for optional query map (#132)
Oct 26, 2018
6a6d222
Feature/update setup doc (#131)
Oct 26, 2018
e6e6373
Merge branch 'master' into develop
qsoftdevelopment Oct 26, 2018
51c19f5
Feature/release 4.21.0 (#134)
Oct 26, 2018
f0030c4
Edit yaml file
Oct 30, 2018
1caf8e5
Library and test update (#138)
qsoftdevelopment Jan 31, 2019
c0133be
Syncing with master (#140)
qsoftdevelopment Jan 31, 2019
4a51ada
Merge branch 'master' into develop
Jan 31, 2019
6b53f62
Feature/unread messages (#142)
qsoftdevelopment Feb 26, 2019
b301839
Sync changes (#144)
qsoftdevelopment Feb 27, 2019
d992277
Sync (#145)
qsoftdevelopment Feb 27, 2019
8e04f1e
Feature/update message counts (#146)
qsoftdevelopment Mar 13, 2019
eca1894
Prepare for version 4.22.0 (#148)
qsoftdevelopment Apr 19, 2019
0bd943a
Merge branch 'master' into develop
Apr 19, 2019
cebdba9
Update .pubnub.yml
qsoftdevelopment Apr 26, 2019
cecd9f6
Merge branch 'master' into develop
qsoftdevelopment Apr 26, 2019
35879c4
Fix reconnection issues by allowing it solely for network issues (#150)
qsoftdevelopment May 8, 2019
05c4da3
Update Travis to use xenial
qsoftdevelopment May 8, 2019
1bf3b2d
Update .travis.yml (#151)
qsoftdevelopment May 8, 2019
dcf4b27
Fix issues (#152)
qsoftdevelopment May 21, 2019
b46e1b7
Merge remote-tracking branch 'origin/master' into develop
May 21, 2019
3a5028a
Multiple fixes (#155)
qsoftdevelopment Jun 7, 2019
c4cfe51
Merge branch 'master' into develop
Jun 7, 2019
f367dcb
Update yml (#158)
Jul 30, 2019
08298a6
Merge branch 'master' into develop
davidnub Jul 30, 2019
fd8666d
feature/signals (#160)
Aug 8, 2019
f1de523
PubNub SDK 4.26.0 Release (#161)
Aug 9, 2019
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
41 changes: 27 additions & 14 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
name: java
version: 4.25.0
version: 4.26.0
schema: 1
scm: github.com/pubnub/java
files:
- build/libs/pubnub-gson-4.25.0-all.jar
- build/libs/pubnub-gson-4.26.0-all.jar
changelog:
- version: v4.26.0
date: 2019-08-09
changes:
- type: feature
text: Add Signals support
- type: bugfix
text: Expose OkHttp logging interceptor library
- version: v4.25.0
date: 2019-06-06
changes:
Expand Down Expand Up @@ -407,26 +414,32 @@ features:
- SUBSCRIBE-WILDCARD
- SUBSCRIBE-FILTER-EXPRESSION
- SUBSCRIBE-PUBLISHER-UUID
- SUBSCRIBE-SIGNAL-LISTENER
signal:
- SIGNAL-SEND
supported-platforms:
- version: PubNub Java SDK
platforms:
- Windows 10 (7u85 and above)
- Windows 10 (8u51 and above)
- Windows 8.x (Desktop)
- Windows 7 SP1
- Windows Vista SP2
- Windows Server 2008 SP2 and 2008 R2 SP1 (64-bit)
- Windows Server 2012 (64-bit) and 2012 R2 (64-bit)
- Intel-based Mac running Mac OS X 10.7.3 (Lion) or later.
- Windows Server 2008 R2 SP1 (64-bit)
- Windows Server 2012 and 2012 R2 (64-bit)
- Intel-based Mac running Mac OS X 10.8.3+, 10.9+
- Oracle Linux 5.5+
- Oracle Linux 6.x (32-bit), 6.x (64-bit)3
- Oracle Linux 7.x (64-bit)3 (7u67 and above)
- Red Hat Enterprise Linux 5.5+, 6.x (32-bit), 6.x (64-bit)3
- Red Hat Enterprise Linux 7.x (64-bit)3 (7u67 and above)
- Suse Linux Enterprise Server 10 SP2, 11.x
- Suse Linux Enterprise Server 12.x (7u75 and above)
- Ubuntu Linux 10.04 and above
- Oracle Linux 6.x
- Oracle Linux 7.x (64-bit) (8u20 and above)
- Red Hat Enterprise Linux 5.5+, 6.x
- Red Hat Enterprise Linux 7.x (64-bit) (8u20 and above)
- Suse Linux Enterprise Server 10 SP2+, 11.x
- Suse Linux Enterprise Server 12.x (64-bit) (8u31 and above)
- Ubuntu Linux 12.04 LTS, 13.x
- Ubuntu Linux 14.x (8u25 and above)
- Ubuntu Linux 15.04 (8u45 and above)
- Ubuntu Linux 15.10 (8u65 and above)
editors:
- Java7+
- Java8+
- version: PubNub Android SDK
platforms:
- Android 2.3.1+
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
}
group = 'com.pubnub'

version = '4.25.0'
version = '4.26.0'

description = """"""

Expand All @@ -32,7 +32,7 @@ repositories {

dependencies {
implementation group: 'com.squareup.retrofit2', name: 'retrofit', version: '2.5.0'
implementation group: 'com.squareup.okhttp3', name: 'logging-interceptor', version: '3.12.1'
api group: 'com.squareup.okhttp3', name: 'logging-interceptor', version: '3.12.1'

implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'

Expand Down
7 changes: 6 additions & 1 deletion src/main/java/com/pubnub/api/PubNub.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.pubnub.api.endpoints.presence.SetState;
import com.pubnub.api.endpoints.presence.WhereNow;
import com.pubnub.api.endpoints.pubsub.Publish;
import com.pubnub.api.endpoints.pubsub.Signal;
import com.pubnub.api.endpoints.push.AddChannelsToPush;
import com.pubnub.api.endpoints.push.ListPushProvisions;
import com.pubnub.api.endpoints.push.RemoveAllPushChannelsForDevice;
Expand Down Expand Up @@ -63,7 +64,7 @@ public class PubNub {
private static final int TIMESTAMP_DIVIDER = 1000;
private static final int MAX_SEQUENCE = 65535;

private static final String SDK_VERSION = "4.25.0";
private static final String SDK_VERSION = "4.26.0";

public PubNub(PNConfiguration initialConfig) {
this.configuration = initialConfig;
Expand Down Expand Up @@ -170,6 +171,10 @@ public Publish publish() {
return new Publish(this, publishSequenceManager, this.telemetryManager, this.retrofitManager);
}

public Signal signal() {
return new Signal(this, this.telemetryManager, this.retrofitManager);
}

public ListAllChannelGroup listAllChannelGroups() {
return new ListAllChannelGroup(this, this.telemetryManager, this.retrofitManager);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ public abstract class SubscribeCallback {
public abstract void message(PubNub pubnub, PNMessageResult message);

public abstract void presence(PubNub pubnub, PNPresenceEventResult presence);

public abstract void signal(PubNub pubnub, PNMessageResult signal);
}
101 changes: 101 additions & 0 deletions src/main/java/com/pubnub/api/endpoints/pubsub/Signal.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
package com.pubnub.api.endpoints.pubsub;

import com.pubnub.api.PubNub;
import com.pubnub.api.PubNubException;
import com.pubnub.api.PubNubUtil;
import com.pubnub.api.builder.PubNubErrorBuilder;
import com.pubnub.api.endpoints.Endpoint;
import com.pubnub.api.enums.PNOperationType;
import com.pubnub.api.managers.MapperManager;
import com.pubnub.api.managers.RetrofitManager;
import com.pubnub.api.managers.TelemetryManager;
import com.pubnub.api.models.consumer.PNPublishResult;
import lombok.Setter;
import lombok.experimental.Accessors;
import retrofit2.Call;
import retrofit2.Response;

import java.util.Collections;
import java.util.List;
import java.util.Map;

@Accessors(chain = true, fluent = true)
public class Signal extends Endpoint<List<Object>, PNPublishResult> {

@Setter
private Object message;

@Setter
private String channel;

public Signal(PubNub pubnub, TelemetryManager telemetryManager, RetrofitManager retrofit) {
super(pubnub, telemetryManager, retrofit);
}

@Override
protected List<String> getAffectedChannels() {
return Collections.singletonList(channel);
}

@Override
protected List<String> getAffectedChannelGroups() {
return null;
}

@Override
protected void validateParams() throws PubNubException {
if (message == null) {
throw PubNubException.builder().pubnubError(PubNubErrorBuilder.PNERROBJ_MESSAGE_MISSING).build();
}
if (channel == null || channel.isEmpty()) {
throw PubNubException.builder().pubnubError(PubNubErrorBuilder.PNERROBJ_CHANNEL_MISSING).build();
}
if (this.getPubnub().getConfiguration().getSubscribeKey() == null || this.getPubnub()
.getConfiguration()
.getSubscribeKey()
.isEmpty()) {
throw PubNubException.builder().pubnubError(PubNubErrorBuilder.PNERROBJ_SUBSCRIBE_KEY_MISSING).build();
}
if (this.getPubnub().getConfiguration().getPublishKey() == null || this.getPubnub()
.getConfiguration()
.getPublishKey()
.isEmpty()) {
throw PubNubException.builder().pubnubError(PubNubErrorBuilder.PNERROBJ_PUBLISH_KEY_MISSING).build();
}
}

@Override
protected Call<List<Object>> doWork(Map<String, String> params) throws PubNubException {
MapperManager mapper = this.getPubnub().getMapper();

String stringifiedMessage = mapper.toJson(message);

params.putAll(encodeParams(params));

stringifiedMessage = PubNubUtil.urlEncode(stringifiedMessage);

return this.getRetrofit().getSignalService().signal(this.getPubnub().getConfiguration().getPublishKey(),
this.getPubnub().getConfiguration().getSubscribeKey(),
channel, stringifiedMessage, params);

}

@Override
protected PNPublishResult createResponse(Response<List<Object>> input) throws PubNubException {
PNPublishResult.PNPublishResultBuilder pnPublishResult = PNPublishResult.builder();
pnPublishResult.timetoken(Long.valueOf(input.body().get(2).toString()));

return pnPublishResult.build();
}

@Override
protected PNOperationType getOperationType() {
return PNOperationType.PNSignalOperation;
}

@Override
protected boolean isAuthRequired() {
return true;
}

}
1 change: 1 addition & 0 deletions src/main/java/com/pubnub/api/enums/PNOperationType.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public enum PNOperationType {
PNUnsubscribeOperation,

PNPublishOperation,
PNSignalOperation,

PNHistoryOperation,
PNFetchMessagesOperation,
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/com/pubnub/api/managers/ListenerManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@ public void announce(PNStatus status) {
}
}

public void announce(PNMessageResult message) {
public void announce(PNMessageResult message, Integer type) {
for (SubscribeCallback subscribeCallback : getListeners()) {
subscribeCallback.message(this.pubnub, message);
if (type == null) {
subscribeCallback.message(this.pubnub, message);
} else if (type == 1) {
subscribeCallback.signal(this.pubnub, message);
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/pubnub/api/managers/RetrofitManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public class RetrofitManager {
private PublishService publishService;
@Getter
private SubscribeService subscribeService;
@Getter
private SignalService signalService;


@Getter
private Retrofit transactionInstance;
Expand Down Expand Up @@ -76,6 +79,7 @@ public RetrofitManager(PubNub pubNubInstance) {
this.publishService = transactionInstance.create(PublishService.class);
this.subscribeService = subscriptionInstance.create(SubscribeService.class);
this.timeService = transactionInstance.create(TimeService.class);
this.signalService = transactionInstance.create(SignalService.class);

}

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/pubnub/api/managers/TelemetryManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ private static String endpointNameForOperation(PNOperationType type) {
case PNAccessManagerGrant:
endpoint = "pam";
break;
case PNMessageCountOperation:
endpoint = "mc";
break;
case PNSignalOperation:
endpoint = "sig";
break;
default:
endpoint = "time";
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,8 @@ public class SubscribeMessage {

//@SerializedName("w")
//private String waypointList;

@SerializedName("e")
private Integer type;

}
20 changes: 20 additions & 0 deletions src/main/java/com/pubnub/api/services/SignalService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.pubnub.api.services;

import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Path;
import retrofit2.http.QueryMap;

import java.util.List;
import java.util.Map;

public interface SignalService {

@GET("/signal/{pubKey}/{subKey}/0/{channel}/0/{payload}")
Call<List<Object>> signal(@Path("pubKey") String pubKey,
@Path("subKey") String subKey,
@Path("channel") String channel,
@Path(value = "payload", encoded = true) String message,
@QueryMap(encoded = true) Map<String, String> options);

}
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,7 @@ private void processIncomingPayload(SubscribeMessage message) {
.userMetadata(message.getUserMetadata())
.build();


listenerManager.announce(pnMessageResult);
listenerManager.announce(pnMessageResult, message.getType());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/pubnub/api/PubNubTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void getVersionAndTimeStamp() {
pubnub = new PubNub(pnConfiguration);
String version = pubnub.getVersion();
int timeStamp = pubnub.getTimestamp();
Assert.assertEquals("4.25.0", version);
Assert.assertEquals("4.26.0", version);
Assert.assertTrue(timeStamp > 0);
}

Expand Down
Loading