CloudSignal Docs
GuidesConnecting

Connection parameters

Complete reference for all CloudSignal MQTT connection parameters.

This page provides a complete reference for all connection parameters when connecting to CloudSignal.

Endpoints

CloudSignal exposes two encrypted endpoints.

TransportURL
MQTT over TLSmqtts://mqtt.cloudsignal.app:8883
MQTT over WSSwss://connect.cloudsignal.app:18885/

Use the TLS endpoint for backend services and native MQTT clients. Use the WSS endpoint for browser clients and WebSocket transport.

Authentication

Required parameters

ParameterFormatExample
Username{mqtt_username}@{organization_id}agent-001@a1b2c3d4-e5f6-7890-abcd-ef1234567890
PasswordStringYour client password

Username format

The username consists of two parts separated by @:

{mqtt_username}@{organization_id}

Where:
  mqtt_username   = The name you assigned when creating the client
  organization_id = Your CloudSignal organization UUID

Find your organization ID in SettingsOrganization in the dashboard.

TLS configuration

Certificate requirements

CloudSignal uses certificates signed by well-known Certificate Authorities. Most MQTT clients automatically trust these certificates.

You don't need to:

  • Download or install custom certificates.
  • Configure CA bundles manually.
  • Use self-signed certificates.

If your client requires explicit TLS configuration, the snippets below cover the common cases.

// Most clients - just enable TLS
const client = mqtt.connect('mqtts://mqtt.cloudsignal.app:8883', {
  username: 'user@org',
  password: 'pass',
});

// If you need explicit config
const client = mqtt.connect('mqtts://mqtt.cloudsignal.app:8883', {
  username: 'user@org',
  password: 'pass',
  rejectUnauthorized: true, // Verify server certificate (default)
});
import ssl

# Standard TLS (uses system CA certificates)
client.tls_set(cert_reqs=ssl.CERT_REQUIRED)
client.connect('mqtt.cloudsignal.app', 8883)

Client ID

The client ID identifies your connection. If not specified, the broker generates one.

Recommendations

Use caseClient ID strategy
Single agent or workerUse a stable identifier: worker-abc123
User sessionInclude user ID: user-12345-session
ServerlessRandom per invocation: lambda-{uuid}
BrowserRandom or session-based

Example

const client = mqtt.connect('mqtts://mqtt.cloudsignal.app:8883', {
  clientId: 'agent-research-01',
  username: 'agent@org-id',
  password: 'password',
});

Client IDs must be unique per organization. Two clients with the same ID will cause disconnection loops.

Keep alive

Keep alive determines how often the client sends ping packets to maintain the connection.

SettingDefaultRecommended
Keep alive60 seconds30-120 seconds
const client = mqtt.connect('mqtts://mqtt.cloudsignal.app:8883', {
  keepalive: 60, // seconds
  // ... other options
});

Guidelines:

  • Mobile apps: higher values (120s) to save battery.
  • Critical agents: lower values (30s) for faster disconnect detection.
  • Web apps: default (60s) is usually fine.

Clean session

Clean session determines whether the broker stores session state.

ValueBehavior
trueStart fresh; no queued messages, no persistent subscriptions
falseResume previous session; receive queued QoS 1 or QoS 2 messages
const client = mqtt.connect('mqtts://mqtt.cloudsignal.app:8883', {
  clean: true, // or false for persistent sessions
  clientId: 'my-client', // Required for persistent sessions
  // ... other options
});

Persistent sessions (clean: false) require a consistent clientId. Without it, the broker can't identify returning clients.

MQTT protocol version

CloudSignal supports both MQTT 3.1.1 and MQTT 5.0.

// MQTT 5.0 (recommended)
const client = mqtt.connect('mqtts://mqtt.cloudsignal.app:8883', {
  protocolVersion: 5,
  // ... other options
});

// MQTT 3.1.1 (default in most libraries)
const client = mqtt.connect('mqtts://mqtt.cloudsignal.app:8883', {
  protocolVersion: 4, // MQTT 3.1.1
  // ... other options
});

MQTT 5.0 features

FeatureWhat it adds
Reason codesDetailed error information
User propertiesCustom key-value metadata
Topic aliasesReduced bandwidth for repeated topics
Message expiryAutomatic message cleanup
Shared subscriptionsLoad balancing across clients

Reconnection

Configure automatic reconnection for connection drops:

const client = mqtt.connect('mqtts://mqtt.cloudsignal.app:8883', {
  reconnectPeriod: 1000, // Try every one second
  connectTimeout: 30 * 1000, // 30 second timeout
  // ... other options
});

Best practices:

  • Use exponential backoff in custom reconnect logic.
  • Re-subscribe after reconnection if using clean: true.
  • Implement max retry limits for serverless functions.

Complete example

const mqtt = require('mqtt');

const client = mqtt.connect('mqtts://mqtt.cloudsignal.app:8883', {
  // Authentication
  username: 'agent-001@a1b2c3d4-e5f6-7890-abcd-ef1234567890',
  password: process.env.MQTT_PASSWORD,

  // Client identification
  clientId: `agent-001-${Date.now()}`,

  // Protocol
  protocolVersion: 5,

  // Connection behavior
  clean: true,
  keepalive: 60,
  connectTimeout: 30000,

  // Reconnection
  reconnectPeriod: 1000,

  // TLS (automatic for mqtts://)
  rejectUnauthorized: true,
});

client.on('connect', () => {
  console.log('Connected to CloudSignal');
});

client.on('error', (err) => {
  console.error('Connection error:', err);
});

client.on('close', () => {
  console.log('Connection closed');
});

Next steps

On this page