Created
January 10, 2017 14:53
-
-
Save push-gists/668cdb3fcfb31c08cea2202339add57f to your computer and use it in GitHub Desktop.
A Java Reappt client that subscribes another client to a topic
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
import java.util.Collection; | |
import com.pushtechnology.diffusion.client.Diffusion; | |
import com.pushtechnology.diffusion.client.callbacks.ErrorReason; | |
import com.pushtechnology.diffusion.client.features.control.topics.SubscriptionControl; | |
import com.pushtechnology.diffusion.client.features.control.topics.SubscriptionControl.SubscriptionByFilterCallback; | |
import com.pushtechnology.diffusion.client.session.Session; | |
import com.pushtechnology.diffusion.client.types.ErrorReport; | |
public class Gatekeeper { | |
private static Session session; | |
private static SubscriptionControl subscriptionControl; | |
public static void main(String... arguments) throws Exception { | |
// Connect to Reappt | |
session = Diffusion.sessions().principal("gatekeeper") | |
.password("repeeketag") | |
.open("wss://approvingBoldDaVinci.us.reappt.io:443"); | |
subscriptionControl = session.feature(SubscriptionControl.class); | |
// Subscribe the Requester session to the closed/cats topic | |
subscriptionControl.subscribeByFilter("$Principal IS 'requester'", | |
"closed/cats", new SubscriptionByFilterCallback.Default()); | |
while(true){ | |
// Loop a while | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment