Skip to content

Commit

Permalink
docs: added architecture description
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghamza-Jd committed Nov 3, 2024
1 parent 2107451 commit 1d383b2
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
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

0 comments on commit 1d383b2

Please sign in to comment.