Other Supported Protocols
Relevant source files
The following files were used as context for generating this wiki page:
Matterbridge is a multi-protocol chat bridge designed to connect various communication platforms. While it supports major platforms like Mattermost, Slack, and Discord, it also maintains extensive support for a diverse range of "Other Supported Protocols," including IRC, Mumble, XMPP, and several 3rd-party integrations via its internal API.
The system is built to be modular, allowing users to enable or disable specific bridges at compile-time using Go build tags. This flexibility ensures that the binary remains lightweight for specific use cases while retaining the capability to bridge dozens of disparate chat networks simultaneously.
Sources: README.md:1-25, README.md:144-160
Natively Supported Protocols
Matterbridge includes native support for numerous protocols, ranging from traditional IRC to modern team collaboration tools like Microsoft Teams and Zulip.
IRC (Internet Relay Chat)
The IRC implementation leverages the girc library, which provides a flexible and event-based approach to IRC communication. It supports IRCv3 specifications, including SASL authentication and message tags.
Key Features of IRC Support:
- Nick Handling: Automatic nick collision detection and prevention.
- Rate Limiting: Built-in event and message rate limiting to prevent server kicks.
- IRCv3 Support: Capabilities like
account-notify,away-notify, andextended-join. - Validation: Methods to validate channel names and nicks according to IRC standards.
Sources: vendor/github.com/lrstanley/girc/README.md:40-62, README.md:84
Discord
Native Discord support is provided through the discordgo package. It offers low-level bindings to the Discord API, covering REST endpoints, WebSockets, and voice interfaces.
The diagram shows the communication flow between Matterbridge and the Discord infrastructure via the DiscordGo library.
Sources: vendor/github.com/bwmarrin/discordgo/README.md:12-16, README.md:81
Additional Native Protocols
The following table lists other natively supported protocols and their primary characteristics:
| Protocol | Description | Implementation Detail |
|---|---|---|
| Microsoft Teams | Enterprise chat | Can be excluded via nomsteams build tag to save memory |
| Zulip | Threaded chat | Uses gozulipbot library; can be excluded via nozulip |
| Mumble | VoIP/Chat | Uses gumble / mumble libraries |
| Mobile messaging | Supports legacy and multi-device (beta) via whatsappmulti tag | |
| Telegram | Mobile messaging | Uses telegram-bot-api |
| XMPP | Extensible protocol | Uses go-xmpp |
| Sources: README.md:81-103, README.md:144-170 |
3rd Party Integration via API
Matterbridge provides a REST-based API that allows 3rd party developers to bridge protocols not natively supported. This is often used for gaming servers and custom web applications.
API Architecture
The API system uses the echo web framework for routing and melody for WebSocket-based real-time message streaming.
The sequence diagram illustrates how a 3rd party application sends a message through the Matterbridge API to other connected native bridges.
Sources: contrib/api.yaml:14-33, vendor/github.com/olahol/melody/README.md:15-35, vendor/github.com/labstack/echo/v4/README.md:46-70
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/health | GET | Checks if the server is alive |
/api/message | POST | Creates a message to be sent to the gateway |
/api/messages | GET | Lists new messages (requires ApiKeyAuth) |
/api/stream | GET | Real-time WebSocket/JSON stream of messages |
| Sources: contrib/api.yaml:14-55 |
Supported 3rd Party Projects
Several projects utilize this API to extend Matterbridge functionality:
- Minecraft: MatterLink, MatterCraft, and MatterBukkit.
- Social Media: Reddit (Mattereddit), Facebook Messenger (fbridge).
- Gaming: Counter-Strike and Half-Life via MatterAMXX.
- Other: TeamSpeak (ts-matterbridge), Discourse (matterbabble).
Sources: README.md:105-132
Data Structures
The system uses standardized message objects to ensure compatibility when bridging "Other Protocols."
Incoming Message Model
| Field | Type | Description |
|---|---|---|
username | string | Human-readable username from the source |
text | string | The message content |
protocol | string | Source protocol (e.g., "irc", "api", "discord") |
gateway | string | The configured gateway name |
extra | object | Additional data like base64 encoded files |
| Sources: contrib/api.yaml:70-118 |
Summary
Matterbridge's support for "Other Protocols" is achieved through a combination of native Go library implementations for standard chat protocols (like IRC and Discord) and a robust API for 3rd party extensions (like Minecraft and TeamSpeak). This architectural approach allows Matterbridge to serve as a universal translator across nearly any chat platform, provided there is either a Go library or a way to interface with its REST/WebSocket API.
Sources: README.md:21-40, contrib/api.yaml:5-10