Rucent
Rucent is a Rust library designed to facilitate communication with Centrifugo's HTTP API. It provides seamless interaction with Centrifugo's server for managing real-time messaging and client interactions. With Rucent, you can issue API commands such as publishing messages, managing subscriptions, and retrieving history data.
Features
- Publish messages to specific channels.
- Manage subscriptions and disconnections.
- Retrieve historical data from Centrifugo.
- Batch multiple commands in a single request for efficiency.
Requirements
Before using Rucent, ensure you have:
- Rust installed on your system (version 1.65 or later).
- A running instance of Centrifugo.
Installation
Add the Rucent library to your Cargo.toml dependencies:
[]
= "0.1.1"
Enable optional features as needed:
[]
= []
Usage
Example: Sending a Publish Command
use ;
async
Example: Broadcast to Multiple Channels
--snip--
let mut channels = Vecnew;
for i in 0..10
let broadcast_result = client
.broadcast
.await;
info!;
Example: Batching Multiple Commands
async
Running Tests
With Local Environment
To run tests using a local Centrifugo instance, provide the required environment variables:
API_URL=http://127.0.0.1:8000/api API_KEY=fa7ce149-b279-4870-af59-ad7ce78ef11a
Without Local Environment
To run tests without a local Centrifugo instance:
Contributing
We welcome contributions! Feel free to open issues, submit pull requests, or suggest new features.
Steps to Contribute
- Fork the repository.
- Create a feature branch:
git checkout -b feature-branch-name. - Make your changes and commit them:
git commit -m "Description of changes". - Push to your fork:
git push origin feature-branch-name. - Open a pull request against the main repository.
License
Rucent is licensed under either of the following licenses, at your option:
- MIT License
- Apache License 2.0
See LICENSE-MIT or LICENSE-APACHE for details.