Server Setup
ConoStream SDK connects to our cloud infrastructure for room management, signaling, and media routing. This guide covers how to get started with ConoStream Cloud.
ConoStream Cloud
ConoStream Cloud is a fully managed streaming infrastructure. We handle all the server management, scaling, and maintenance so you can focus on building your app.
Benefits
- No maintenance - We manage all infrastructure
- Global CDN - Low latency worldwide
- Auto-scaling - Handles traffic spikes automatically
- 99.9% uptime - Enterprise-grade reliability
- 24/7 support - Technical assistance when you need it
Getting Started
- Contact us at support@conostream.nl for cloud access
- You'll receive:
- Server URL:
wss://cloud.conostream.nl - API Key
- API Secret
- Server URL:
- Use these credentials in your app
Token Generation
Clients need a JWT token to connect to rooms. Your backend server should generate these tokens using your API key and secret.
Token Structure
// JWT payload for room access
{
"exp": 1234567890, // Expiration time
"iss": "APIxxxxxxxx", // API Key
"sub": "user_123", // Participant identity
"name": "John Doe", // Display name
"video": {
"room": "my-room", // Room name
"roomJoin": true, // Can join room
"canPublish": true, // Can publish tracks
"canSubscribe": true // Can subscribe to tracks
}
}
PHP Token Generation Example
<?php
use Firebase\JWT\JWT;
function generateToken($roomName, $participantId, $participantName, $canPublish = true) {
$apiKey = 'APIxxxxxxxx';
$apiSecret = 'secretxxxxxxxxxxxxxxxxxxxxxxxxx';
$payload = [
'exp' => time() + 3600, // 1 hour expiry
'iss' => $apiKey,
'sub' => $participantId,
'name' => $participantName,
'video' => [
'room' => $roomName,
'roomJoin' => true,
'canPublish' => $canPublish,
'canSubscribe' => true
]
];
return JWT::encode($payload, $apiSecret, 'HS256');
}
// API endpoint
$token = generateToken('live_room_123', 'user_456', 'John', true);
echo json_encode(['token' => $token]);
?>
Node.js Token Generation Example
const jwt = require('jsonwebtoken');
function generateToken(roomName, participantId, participantName, canPublish = true) {
const apiKey = 'APIxxxxxxxx';
const apiSecret = 'secretxxxxxxxxxxxxxxxxxxxxxxxxx';
const payload = {
iss: apiKey,
sub: participantId,
name: participantName,
video: {
room: roomName,
roomJoin: true,
canPublish: canPublish,
canSubscribe: true
}
};
return jwt.sign(payload, apiSecret, {
algorithm: 'HS256',
expiresIn: '1h'
});
}
// Express endpoint
app.get('/api/token', (req, res) => {
const token = generateToken(req.query.room, req.query.userId, req.query.name);
res.json({ token });
});
Client Configuration
In your Android app, configure the server URL:
// ConoStream Cloud URL
String serverUrl = "wss://cloud.conostream.nl";
// Fetch token from your backend
String token = fetchTokenFromBackend(roomName, userId);
// Connect
manager.connect(serverUrl, token, listener);
Need Help? Contact us at support@conostream.nl for assistance or to discuss your specific requirements.