Class PusherAsync

All Implemented Interfaces:
AutoCloseable

A library for interacting with the Pusher HTTP API asynchronously.

See http://github.com/pusher/pusher-http-java for an overview

Essentially:

 // Init
 PusherAsync pusher = new PusherAsync(APP_ID, KEY, SECRET);

 // Publish
 CompletableFuture<Result> futureTriggerResult = pusher.trigger("my-channel", "my-eventname", myPojoForSerialisation);
 triggerResult.thenAccept(triggerResult -> {
   if (triggerResult.getStatus() == Status.SUCCESS) {
     // request was successful
   } else {
     // something went wrong with the request
   }
 });

 // Query
 CompletableFuture<Result> futureChannelListResult = pusher.get("/channels");
 futureChannelListResult.thenAccept(triggerResult -> {
   if (triggerResult.getStatus() == Status.SUCCESS) {
     String channelListAsJson = channelListResult.getMessage();
     // etc.
   } else {
     // something went wrong with the request
   }
 });
 
See Pusher for the synchronous implementation.
  • Constructor Details

    • PusherAsync

      public PusherAsync(String appId, String key, String secret)
      Construct an instance of the Pusher object through which you may interact with the Pusher API.

      The parameters to use are found on your dashboard at https://app.pusher.com and are specific per App.

      Parameters:
      appId - The ID of the App you will to interact with.
      key - The App Key, the same key you give to websocket clients to identify your app when they connect to Pusher.
      secret - The App Secret. Used to sign requests to the API, this should be treated as sensitive and not distributed.
    • PusherAsync

      public PusherAsync(String appId, String key, String secret, String encryptionMasterKeyBase64)
      Construct an instance of the Pusher object through which you may interact with the Pusher API.

      The parameters to use are found on your dashboard at https://app.pusher.com and are specific per App.

      Parameters:
      appId - The ID of the App you will to interact with.
      key - The App Key, the same key you give to websocket clients to identify your app when they connect to Pusher.
      secret - The App Secret. Used to sign requests to the API, this should be treated as sensitive and not distributed.
      encryptionMasterKeyBase64 - 32 byte key, base64 encoded. This key, along with the channel name, are used to derive per-channel encryption keys.
    • PusherAsync

      public PusherAsync(String url)
  • Method Details