MMTMMT Docs
WebSocket

Connecting

How to establish and authenticate WebSocket connections, including regional endpoints, connection limits, and response formats.

Connection URL

wss://{region}.mmt.gg/api/v1/ws

Available Regions:

  • eu-central-1.mmt.gg (Frankfurt)

Authentication

Authentication is required for all WebSocket connections. Include your API key as a query parameter:

ParameterRequiredDescription
api_keyYesYour API key
formatNoResponse format: json (default) or cbor

Security model: API keys are secret server-side credentials. Do not connect directly from browser/mobile clients with your real key. Use your backend to manage the upstream WebSocket connection and relay sanitized data downstream.

URL Examples

JSON format (default):

wss://eu-central-1.mmt.gg/api/v1/ws?api_key=YOUR_KEY

CBOR format:

wss://eu-central-1.mmt.gg/api/v1/ws?api_key=YOUR_KEY&format=cbor

Frame Type by Format

  • format=json (default): server sends WebSocket text frames (JSON strings)
  • format=cbor: server sends WebSocket binary frames (CBOR bytes)

Connection Limits

The maximum number of concurrent WebSocket connections depends on your subscription tier:

TierMax Connections
Basic5
Pro15

Connection Behavior

Successful Connection

When authentication succeeds and you have not exceeded your connection limit, the WebSocket connection is accepted. The server sends a connected message with your session information:

{
  "type": "connected",
  "tier": "pro",
  "max_subscriptions": 100,
  "format": "json"
}
FieldTypeDescription
typestringAlways "connected"
tierstringYour API tier (basic, pro)
max_subscriptionsintMaximum subscriptions allowed on this connection
formatstringResponse format (json or cbor)

After receiving this message, you can begin subscribing to channels.

Failed Connection

Connections may be rejected for the following reasons:

ReasonBehavior
Invalid API keyConnection rejected with error
Max connections exceededConnection rejected

When a connection is rejected, the WebSocket handshake fails and you will not be able to establish a connection.

CORS

Direct browser usage is not a supported security model for secret API keys. If you are troubleshooting browser CORS/websocket issues, move the MMT connection to your backend and expose a backend endpoint/socket to your frontend instead.

On this page