java.lang.Object
ch.rasc.jcentserverclient.CentrifugoServerApiClient
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbatch()Get the Batch API client for sending multiple commands in a single request.channels()Get the Channels API client for managing channel information.Get the Connection Management API client for managing client connections.static CentrifugoServerApiClientcreate(Configuration configuration) Create a new Centrifugo Server API client with the given configuration.static CentrifugoServerApiClientCreate a new Centrifugo Server API client with custom configuration.history()Get the History API client for managing channel history.presence()Get the Presence API client for managing channel presence information.Get the Publication API client for publishing data to channels.stats()Get the Stats API client for retrieving server statistics.token()Get the Token API client for managing authentication tokens.Get the User Block API client for managing user blocking functionality.
-
Field Details
-
token
-
-
Constructor Details
-
CentrifugoServerApiClient
public CentrifugoServerApiClient()
-
-
Method Details
-
create
public static CentrifugoServerApiClient create(Function<Configuration.Builder, Configuration.Builder> fn) Create a new Centrifugo Server API client with custom configuration.- Parameters:
fn- function to configure the client builder- Returns:
- configured client instance
-
create
Create a new Centrifugo Server API client with the given configuration.- Parameters:
configuration- the client configuration- Returns:
- configured client instance
-
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
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
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
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
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
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
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
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
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:
-