# meetecho/janus-gateway architecture

> Architecture diagram of the GitHub repository meetecho/janus-gateway, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/meetecho/janus-gateway
- Repository: https://github.com/meetecho/janus-gateway

## Overview

Janus is a general-purpose WebRTC server. A client sends JSON API requests through a configured transport; the Janus core manages sessions and WebRTC handles, with plugins providing application behavior and media handling. Recording and event notifications are additional product branches, and recorded media can be processed by standalone utilities. The README excerpt documents REST and WebSocket support and plugin capabilities at a high level; detailed core dispatch and several plugin implementations were not sampled, so those links are marked unverified.

Main entry points: [`src/janus.c`](https://github.com/meetecho/janus-gateway/blob/master/src/janus.c) (Janus Core), [`src/rtp.c`](https://github.com/meetecho/janus-gateway/blob/master/src/rtp.c) (RTP Processing), [`src/postprocessing/janus-pp-rec.c`](https://github.com/meetecho/janus-gateway/blob/master/src/postprocessing/janus-pp-rec.c) (Recording Post-Processor), [`src/transports/janus_http.c`](https://github.com/meetecho/janus-gateway/blob/master/src/transports/janus_http.c) (HTTP Transport)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and Core"]
  node_http["HTTP Transport<br/>[janus_http.c]"]
  node_websocket["WebSocket Transport<br/>[janus_websockets.c]"]
  node_mqtt["MQTT Transport<br/>[janus_mqtt.c]"]
  node_core["Janus Core<br/>[janus.c]"]
  node_auth["Request Auth<br/>[auth.c]"]
  node_config["Configuration<br/>[config.h]"]
end

subgraph group_media["WebRTC Media"]
  node_sdp["SDP Handling<br/>[sdp.c]"]
  node_ice["ICE Connectivity<br/>[ice.c]"]
  node_dtls["DTLS Security<br/>[dtls.c]"]
  node_rtp["RTP Processing<br/>[rtp.c]"]
  node_rtcp["RTCP Processing<br/>[rtcp.c]"]
  node_sctp["Data Channels<br/>[sctp.c]"]
end

subgraph group_plugins["Application Plugins"]
  node_streaming["Streaming Plugin<br/>[janus_streaming.c]"]
  node_audiobridge["AudioBridge Plugin"]
  node_otherplugins["Other Plugins"]
end

subgraph group_operations["Events and Recordings"]
  node_events["Event Dispatch<br/>[events.h]"]
  node_eventhandler["Event Handlers<br/>[eventhandler.h]"]
  node_recording["Recording Support<br/>[record.c]"]
  node_postprocess["Recording Post-Processor<br/>[janus-pp-rec.c]"]
  node_recordfiles[("Recording Files")]
end

node_client(("WebRTC Client"))

node_client -->|"sends API requests"| node_http
node_client -.->|"uses API transport"| node_websocket
node_client -.->|"uses API transport"| node_mqtt
node_http -->|"forwards API requests"| node_core
node_websocket -.->|"forwards API requests"| node_core
node_mqtt -.->|"forwards API requests"| node_core
node_core -.->|"checks credentials"| node_auth
node_core -.->|"loads settings"| node_config
node_core -.->|"dispatches plugin requests"| node_streaming
node_core -.->|"dispatches plugin requests"| node_audiobridge
node_core -.->|"dispatches plugin requests"| node_otherplugins
node_core -.->|"handles negotiation"| node_sdp
node_core -.->|"sets up connectivity"| node_ice
node_core -.->|"secures media"| node_dtls
node_core -.->|"supports data channels"| node_sctp
node_streaming -.->|"processes media"| node_rtp
node_audiobridge -.->|"processes media"| node_rtp
node_core -.->|"notifies events"| node_events
node_events -->|"invokes callbacks"| node_eventhandler
node_core -.->|"records media"| node_recording
node_recording -.->|"writes recordings"| node_recordfiles
node_postprocess -->|"reads recordings"| node_recordfiles
node_postprocess -->|"parses packets"| node_rtp

click node_http "https://github.com/meetecho/janus-gateway/blob/master/src/transports/janus_http.c"
click node_websocket "https://github.com/meetecho/janus-gateway/blob/master/src/transports/janus_websockets.c"
click node_mqtt "https://github.com/meetecho/janus-gateway/blob/master/src/transports/janus_mqtt.c"
click node_core "https://github.com/meetecho/janus-gateway/blob/master/src/janus.c"
click node_auth "https://github.com/meetecho/janus-gateway/blob/master/src/auth.c"
click node_config "https://github.com/meetecho/janus-gateway/blob/master/src/config.h"
click node_sdp "https://github.com/meetecho/janus-gateway/blob/master/src/sdp.c"
click node_ice "https://github.com/meetecho/janus-gateway/blob/master/src/ice.c"
click node_dtls "https://github.com/meetecho/janus-gateway/blob/master/src/dtls.c"
click node_rtp "https://github.com/meetecho/janus-gateway/blob/master/src/rtp.c"
click node_rtcp "https://github.com/meetecho/janus-gateway/blob/master/src/rtcp.c"
click node_sctp "https://github.com/meetecho/janus-gateway/blob/master/src/sctp.c"
click node_streaming "https://github.com/meetecho/janus-gateway/blob/master/src/plugins/janus_streaming.c"
click node_audiobridge "https://github.com/meetecho/janus-gateway/blob/master/src/plugins/janus_audiobridge.c"
click node_otherplugins "https://github.com/meetecho/janus-gateway/tree/master/src/plugins"
click node_events "https://github.com/meetecho/janus-gateway/blob/master/src/events.h"
click node_eventhandler "https://github.com/meetecho/janus-gateway/blob/master/src/events/eventhandler.h"
click node_recording "https://github.com/meetecho/janus-gateway/blob/master/src/record.c"
click node_postprocess "https://github.com/meetecho/janus-gateway/blob/master/src/postprocessing/janus-pp-rec.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_http,node_websocket,node_mqtt,node_core,node_auth,node_config,node_client toneBlue
class node_sdp,node_ice,node_dtls,node_rtp,node_rtcp,node_sctp toneAmber
class node_streaming,node_audiobridge,node_otherplugins toneMint
class node_events,node_eventhandler,node_recording,node_postprocess,node_recordfiles toneRose
```

## Components

### API and Core

- [HTTP Transport](https://github.com/meetecho/janus-gateway/blob/master/src/transports/janus_http.c): `src/transports/janus_http.c`
- [WebSocket Transport](https://github.com/meetecho/janus-gateway/blob/master/src/transports/janus_websockets.c): `src/transports/janus_websockets.c`
- [MQTT Transport](https://github.com/meetecho/janus-gateway/blob/master/src/transports/janus_mqtt.c): `src/transports/janus_mqtt.c`
- [Janus Core](https://github.com/meetecho/janus-gateway/blob/master/src/janus.c): `src/janus.c`
- [Request Auth](https://github.com/meetecho/janus-gateway/blob/master/src/auth.c): `src/auth.c`
- [Configuration](https://github.com/meetecho/janus-gateway/blob/master/src/config.h): `src/config.h`

### WebRTC Media

- [SDP Handling](https://github.com/meetecho/janus-gateway/blob/master/src/sdp.c): `src/sdp.c`
- [ICE Connectivity](https://github.com/meetecho/janus-gateway/blob/master/src/ice.c): `src/ice.c`
- [DTLS Security](https://github.com/meetecho/janus-gateway/blob/master/src/dtls.c): `src/dtls.c`
- [RTP Processing](https://github.com/meetecho/janus-gateway/blob/master/src/rtp.c): `src/rtp.c`
- [RTCP Processing](https://github.com/meetecho/janus-gateway/blob/master/src/rtcp.c): `src/rtcp.c`
- [Data Channels](https://github.com/meetecho/janus-gateway/blob/master/src/sctp.c): `src/sctp.c`

### Application Plugins

- [Streaming Plugin](https://github.com/meetecho/janus-gateway/blob/master/src/plugins/janus_streaming.c): `src/plugins/janus_streaming.c`
- [AudioBridge Plugin](https://github.com/meetecho/janus-gateway/blob/master/src/plugins/janus_audiobridge.c): `src/plugins/janus_audiobridge.c`
- [Other Plugins](https://github.com/meetecho/janus-gateway/tree/master/src/plugins): `src/plugins`

### Events and Recordings

- [Event Dispatch](https://github.com/meetecho/janus-gateway/blob/master/src/events.h): `src/events.h`
- [Event Handlers](https://github.com/meetecho/janus-gateway/blob/master/src/events/eventhandler.h): `src/events/eventhandler.h`
- [Recording Support](https://github.com/meetecho/janus-gateway/blob/master/src/record.c): `src/record.c`
- [Recording Post-Processor](https://github.com/meetecho/janus-gateway/blob/master/src/postprocessing/janus-pp-rec.c): `src/postprocessing/janus-pp-rec.c`
- **Recording Files**

### Other components

- **WebRTC Client**

## Connections

- WebRTC Client → HTTP Transport: sends API requests (evidence: `src/transports/janus_http.c`)
- WebRTC Client → WebSocket Transport: uses API transport
- WebRTC Client → MQTT Transport: uses API transport
- HTTP Transport → Janus Core: forwards API requests (evidence: `src/transports/janus_http.c`)
- WebSocket Transport → Janus Core: forwards API requests
- MQTT Transport → Janus Core: forwards API requests
- Janus Core → Request Auth: checks credentials
- Janus Core → Configuration: loads settings (evidence: `src/janus.c`)
- Janus Core → Streaming Plugin: dispatches plugin requests
- Janus Core → AudioBridge Plugin: dispatches plugin requests
- Janus Core → Other Plugins: dispatches plugin requests
- Janus Core → SDP Handling: handles negotiation
- Janus Core → ICE Connectivity: sets up connectivity
- Janus Core → DTLS Security: secures media
- Janus Core → Data Channels: supports data channels
- Streaming Plugin → RTP Processing: processes media
- AudioBridge Plugin → RTP Processing: processes media (evidence: `src/plugins/janus_audiobridge.c`)
- Janus Core → Event Dispatch: notifies events (evidence: `src/janus.c`)
- Event Dispatch → Event Handlers: invokes callbacks (evidence: `src/events/eventhandler.h`)
- Janus Core → Recording Support: records media
- Recording Support → Recording Files: writes recordings
- Recording Post-Processor → Recording Files: reads recordings (evidence: `src/postprocessing/janus-pp-rec.c`)
- Recording Post-Processor → RTP Processing: parses packets (evidence: `src/postprocessing/janus-pp-rec.c`)
