PushEvent
PushEvent is a simple event dispatch library built on top of ws-rs, that allows you to dispatch events to clients based on what resource they are subscribed to.
/// Basic event struct which serializes with serde to json.
Accessing 127.0.0.1:3012/hello_world
, for example, will subscribe you to that route, yielding you with a
message every 100ms which should be {'message': 'Hello world'}
. This can be further used to build and publish more complex events.
Documentation
PushEvent is simple and straightforward to use:
- Examples: Holds examples of how to use this library.
- API Documentation: The "rustdocs".
Examples
Rocket ships with an extensive number of examples in the examples/
directory
which can be compiled and run with Cargo. For instance, the following sequence
of commands builds and runs the Hello, world!
example:
cd examples/simple
cargo run
You should see {'message': 'Hello world'}
by accessing ws://127.0.0.1:3012
.
Testing
To test this library simply run cargo test
.
Contributing
Contributions are absolutely, positively welcome and encouraged! Contributions come in many forms. You could:
- Submit a feature request or bug report as an issue.
- Ask for improved documentation as an issue.
- Contribute code via merge requests.
All pull requests are code reviewed and tested by the CI. Note that unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in PushEvent by you shall be licensed under the MIT License without any additional terms or conditions.
License
PushEvent is licensed under the MIT License (LICENSE.md or http://opensource.org/licenses/MIT)