Created
February 1, 2017 18:09
-
-
Save anovikov1984/c7430eb3c5b46f3d5aa8034edf230d16 to your computer and use it in GitHub Desktop.
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
public void testSub() throws PubNubException, InterruptedException { | |
PNConfiguration pnConfiguration = new PNConfiguration(); | |
pnConfiguration.setSubscribeKey("demo"); | |
pnConfiguration.setPublishKey("demo"); | |
PubNub pubnub = new PubNub(pnConfiguration); | |
pubnub.addListener(new SubscribeCallback() { | |
@Override | |
public void status(PubNub pubnub, PNStatus status) { | |
} | |
@Override | |
public void message(PubNub pubnub, PNMessageResult message) { | |
System.out.println(message); | |
} | |
@Override | |
public void presence(PubNub pubnub, PNPresenceEventResult presence) { | |
} | |
}); | |
pubnub.subscribe().channels(Arrays.asList("blah")).execute(); | |
// You need to wait for any subscribe callback on you own, for ex: | |
// Thread.sleep(1000*1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment