Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: added architecture description #146

Merged
merged 1 commit into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Jarust is just an umbrella crate for `jarust_core`, `jarust_plugins` and `jarust_interface`.

```mermaid
graph TD
P[jarust_plugins] --> C[jarust_core]
C--> I[jarust_interface]
I --> R[jarust_rt]
C --> R
P --> I
J[jarust] -->|jarust::plugins| P
J -->|jarust::core| C
J -->|jarust::inteface| I
```

## Core

The core provides high-level api to connect, create session, attach, detach, ...

It relies on abstractions from the interface crate, meaning we can provide our own implementation of `JanusInterface` and
pass it to the core, for example, to use the RabbitMQ interface.

## Interface

It contains the core data structures; errors, responses, and messages as well as the transport that communicates with
the janus server. The transport is abstract, so to create a new transport we can implement the `JanusInterface` trait
then provide it to the connect functions.

The transaction generation is also abstract with 2 built-in ones, UUID v4 and random string.

## Plugins

Plugins wraps the generic handle from the core crate and adds the plugin specific functionalities and event parsing,
while also has a handle `Deref` to add unsupported functionalities.

## Runtime

We're trying to be runtime agnostic so we created `jarust_rt` that abstracts the runtime, but currenctly only tokio is supported.

Any task spawing should be from `jarust_rt::spawn` function.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@
[Latest Version]: https://img.shields.io/crates/v/jarust.svg
[crates.io]: https://crates.io/crates/jarust

Jarust is a Rust adapter for [Janus WebRTC server](https://github.com/meetecho/janus-gateway)

Internally uses WebSockets to connect to Janus. But you can provide your own transport.
Jarust is a memory safe and high-performance Rust adapter for [Janus WebRTC server](https://github.com/meetecho/janus-gateway).
Inspired by [Janode](https://github.com/meetecho/janode), jarust offers similar functionalities but it's designed
to be customizable, for exmaple, you could use the built-in WebSocket transport or provide your own RabbitMQ transport implementation. For more details about the architecture check [ARCHITECTURE](./ARCHITECTURE.md).

The library wraps the Janus core API and some of the most popular plugins APIs.

The supported Janus plugins currently are:

- EchoTest
- AudioBridge
- VideoBridge
- Streaming
- VideoRoom

The supported interfaces are:

- WebSocket
- Restful

## Examples

Expand Down
Loading