Headers
The Red5 Pro Stream Manager provides certain information about the originating client using custom headers which can be used in identifying the originating client.
Headers Sent From Stream Manager Proxy to WebRTC Plugin on Red5 Pro
{Sec-WebSocket-Key=XsuhAp80WSWenevmuVlFeQ==, X-Forwarded-For-Meta-Port=52965, X-Forwarded-For-Meta-Type=WEB, User-Agent=Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0, Sec-WebSocket-Version=13, X-Forwarded-For=192.168.1.45, X-Forwarded-For-Meta-Secure=false, Sec-WebSocket-Protocol=json}
Custom Headers
X-Forwarded-For
: Use if you want to know the IP address of the originating client.X-Forwarded-For-Meta-Secure
: Relay whether the client session is over secure connection (or not). This information is obtained through the WebSocket connection object.X-Forwarded-For-Meta-Port
: Relate the originating client’s port.X-Forwarded-For-Meta-Type
: Provides information about the originating client’s connection type. This information is derived from the WebSocket connection class on streammanager. Connection type can beDIRECT
orWEB
.
Client API for Usage
Broadcasters and subscribers need to use the Red5 Pro Stream Manager REST API to request an origin/edge for publish/subscribe operations. Once a server IP has been obtained, it can be used in conjunction with additional parameters to establish a connection with the remote Red5 Pro server node and begin stream operations. This is a two-step process, and the proxy operation is decoupled from Stream Manager internals. The publishing and subscribing is done using the Red5 Pro HTML5 Streaming SDK.
The base configuration
object of the HTML5 client (on the Stream Manager instance) should look like this:
var baseConfiguration = {
host: window.targetHost,
app: 'streammanager',
iceServers: iceServers,
bandwidth: desiredBandwidth,
connectionParams: {host:"<target-server-ip>", app:"<stream-scope>", context:"<optional-sub-scope>"}
};
Connection parameters are required for the HTML5 client to attempt a connection with the remote Red5 Pro server via the Stream Manager proxy.
connectionParams: Connection parameters must include the proxy target server host
and target scope app
for publish and subscribe operations. Any optional connection parameters should also be included, to be forwarded to the target server. Subscopes can be targeted using the context parameter.
host: The target host must be a URL with a valid SSL certificate for proxy.
app: The application parameter should point to streammanager
scope since all traffic will be routed through it.
* `host` : <target-server-url>,
* `app` : <stream-scope>,
* `context` : <optional-sub-scope>
Publish/Subscribe Process Via Proxy
PUBLISHER:
SIMPLE REQUEST
http://{host}:{port}/streammanager/api/3.0/event/{scopeName}/{streamName}?action=broadcast
OR
REGION PRIORITY REQUEST
http://{host}:{port}/streammanager/api/3.0/event/{scopeName}/{streamName}?action=broadcast®ion={region-code}
RESPONSE DATA :
{
"name": "<stream-name>",
"scope": "<stream-scope>",
"serverAddress": "<origin-host-address>",
"region": "<region-code>"
}
GENERIC RED5PRO HTML5 SDK PUBLISHER CONFIGURATION
var baseConfiguration = {
host: streammanager-host,
app: 'streammanager',
iceServers: iceServers,
bandwidth: desiredBandwidth,
connectionParams: {host:"<origin-host-address>", app:"<stream-scope>"}
};
SUBSCRIBER:
SIMPLE REQUEST
http://{host}:{port}/streammanager/api/3.0/event/{scopeName}/{streamName}?action=subscribe
OR
REGION PRIORITY REQUEST
http://{host}:{port}/streammanager/api/1.0/event/{scopeName}/{streamName}?action=subscribe®ion={region-code}
RESPONSE DATA :
{
"name": "<stream-name>",
"scope": "<stream-scope>",
"serverAddress": "<edge-host-address>",
"region": "<region-code>"
}
GENERIC RED5PRO HTML5 SDK SUBSCRIBER CONFIGURATION
var baseConfiguration = {
host: streammanager-host,
app: 'streammanager',
iceServers: iceServers,
bandwidth: desiredBandwidth,
connectionParams: {host:"<edge-host-address>", app:"<stream-scope>"}
};