Expand description
§Pass-It-On
A library that provides simple notification client and server that receives messages and passes them on to endpoints
§Client Example
To use the client to pass messages to the server you will need to pass a valid ClientConfiguration
and a channel receiver to the start client function. It will monitor that channel for incoming
Notification
values and send them in the expected format to server.
async fn main() -> Result<(), Error> {
const NOTIFICATION_NAME: &str = "test1";
let config = ClientConfiguration::from_toml(CLIENT_TOML_CONFIG)?;
let (interface_tx, interface_rx) = mpsc::channel(100);
let messages = vec![
Message::new("A message to be sent").to_client_ready_message(NOTIFICATION_NAME),
Message::new("Another message").to_client_ready_message(NOTIFICATION_NAME),
];
for message in messages {
if let Err(send_error) = interface_tx.send(message).await {
println!("Send Error: {}", send_error);
}
}
start_client(config, interface_rx, None).await?;
Ok(())
}
§Feature Flags
Feature | Description |
---|---|
client | Enables the client but not any particular interface. |
discord | Enables the discord webhook endpoint. |
Enables the email endpoint. | |
endpoints | Enables the Endpoint and EndpointConfig traits. |
file | Enables the regular file endpoint. |
http | Enables the HTTP interface client and server. |
http-client | Enables the HTTP interface for just client. |
http-server | Enables the HTTP interface for just server. |
interfaces | Enables the Interface and InterfaceConfig traits. |
matrix | Enables the matrix endpoint. |
parse-cfg | Enables parsing of client or server configurations from TOML when those features are also enabled. |
pipe | Enables the named pipe interface client and server. (Unix only) |
pipe-client | Enables the named pipe interface client. (Unix only) |
pipe-server | Enables the named pipe interface server. (Unix only) |
server | Enables the server but not any particular interface or endpoint. |
server-bin-full | Enables the building of the provided pass-it-on-server binary with all available interfaces and endpoints |
server-bin-minimal | Enables the building of the provided pass-it-on-server binary while not requiring any specific interface or endpoint |
rustls-tls-native-roots | Enables rustls-tls-native-roots for reqwest. |
Modules§
- Endpoints for the server
- Interfaces for the server and client
- Representation of notification messages.
Structs§
- Serde compatible representation of
ClientConfiguration
- Client configuration that can be used to start the client.
- Serde compatible representation of
ServerConfiguration
- Server configuration that can be used to start the server.
Enums§
- Errors returned by pass-it-on library.
Functions§
- Start the client with provided
ClientConfiguration
andReceiver<ClientReadyMessage>
channel. - Start the client with provided
ClientConfiguration
andArc<Mutex<Vec<ClientReadyMessage>>>
. - Start the server with provided
ServerConfiguration
. - Interactively verify devices for all Matrix endpoints in the provided
ServerConfiguration
.