Class CentrifugoServerApiClient

java.lang.Object
ch.rasc.jcentserverclient.CentrifugoServerApiClient

public class CentrifugoServerApiClient extends Object
Centrifugo Server HTTP API Client

This client provides a Java interface to interact with Centrifugo's HTTP API. Centrifugo is a real-time messaging server that provides publish-subscribe functionality for building scalable real-time applications.

The API supports various operations including:

  • Publishing messages to channels
  • Managing client connections and subscriptions
  • Retrieving channel history and presence information
  • User status management
  • Push notifications
  • Token management
  • Batch operations

Usage example:


 CentrifugoServerApiClient client = CentrifugoServerApiClient.create(
 		config -> config.apiKey("your-api-key").baseUrl("http://localhost:8000/api"));

 PublishResponse response = client.publication().publish(PublishRequest.builder()
 		.channel("chat").data(Map.of("message", "Hello World")).build());
 
Since:
1.0.0
See Also:
  • Field Details

  • Constructor Details

    • CentrifugoServerApiClient

      public CentrifugoServerApiClient()
  • Method Details

    • create

      Create a new Centrifugo Server API client with custom configuration.
      Parameters:
      fn - function to configure the client builder
      Returns:
      configured client instance
    • create

      public static CentrifugoServerApiClient create(Configuration configuration)
      Create a new Centrifugo Server API client with the given configuration.
      Parameters:
      configuration - the client configuration
      Returns:
      configured client instance
    • publication

      public PublicationClient publication()
      Get the Publication API client for publishing data to channels.

      Supports operations like:

      • Publishing data to a single channel
      • Broadcasting data to multiple channels
      Returns:
      the publication client
      See Also:
    • connection

      public ConnectionClient connection()
      Get the Connection Management API client for managing client connections.

      Supports operations like:

      • Subscribing users to channels
      • Unsubscribing users from channels
      • Disconnecting users
      • Refreshing user connections
      Returns:
      the connection client
      See Also:
    • history

      public HistoryClient history()
      Get the History API client for managing channel history.

      Supports operations like:

      • Retrieving channel message history
      • Removing channel history
      Returns:
      the history client
      See Also:
    • presence

      public PresenceClient presence()
      Get the Presence API client for managing channel presence information.

      Supports operations like:

      • Getting channel presence information (all connected clients)
      • Getting channel presence statistics (counts only)
      Returns:
      the presence client
      See Also:
    • stats

      public StatsClient stats()
      Get the Stats API client for retrieving server statistics.

      Supports operations like:

      • Getting active channels information
      • Getting connections information
      • Getting server node information
      Returns:
      the stats client
      See Also:
    • channels

      public ChannelsClient channels()
      Get the Channels API client for managing channel information.

      This is an alias for the stats client that provides channel-specific operations.

      Returns:
      the channels client (same as stats client)
    • userBlock

      public UserBlockClient userBlock()
      Get the User Block API client for managing user blocking functionality.

      Supports operations like:

      • Blocking users
      • Unblocking users
      Returns:
      the user block client
      See Also:
    • token

      public TokenClient token()
      Get the Token API client for managing authentication tokens.

      Supports operations like:

      • Revoking individual tokens
      • Invalidating all user tokens
      Returns:
      the token client
      See Also:
    • batch

      public BatchClient batch()
      Get the Batch API client for sending multiple commands in a single request.

      The batch API allows you to execute multiple API commands efficiently in a single HTTP request, reducing network round-trip time.

      Returns:
      the batch client
      See Also: