# Hive

> Hive is a generic Pub/Sub library for Rust.

By default, Hive provides a very basic pub/sub system which you can integrate into something like a web socket server, this system is perfect for small-scale applications which only use one node.

It is important to note that Hive is not for everyone, all the data is returned through one callback which is intended to be piped into things such as websocket servers, mpsc channels, etc. (If you want this functionality, feel free to contact me and I'll put it higher on my priority list)

For an example on how to use the library, please see the [documentation](https://docs.rs/hive_pubsub/*/hive_pubsub/).

## Design

Hive is designed to be slotted into any server application to act as a middle-man between you and your clients, it will automatically distribute any notifications you give it to all relevant connected clients and other nodes.

<p align="center">
    <img src="assets/concept.png" />
</p>

## Testing

Before testing, specify a MongoDB connection script in your `.env` or just pass it into the environment.

```.env
MONGODB_URI=mongodb+srv://
```

Then, run the following command to run all tests: (this will also show you all the output)

```bash
cargo test --features test -- --nocapture
```
