Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A Java Reappt client that subscribes another client to a topic
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