Skip to main content
Version: 5.7.0

EnableRTT

Attempts to establish an RTT connection to the brainCloud servers.

RTT must be enabled in the Design Portal, under Design | Core App Info | Advanced Settings.

RTT is available to all Plus plan subscriptions.

ServiceOperation
rttRegistrationREQUEST_CLIENT_CONNECTION

Method Parameters

ParameterDescription
connectionTypeType of RTT connections being established. Examples: WebSocket, TCP.

Usage

http://localhost:3000
// Real-time Tech (RTT) must be checked on the dashboard, under Design | Core App Info | Advanced Settings.
eRTTConnectionType rttConnectionType = eRTTConnectionType.WEBSOCKET;
SuccessCallback successCallback = (response, cbObject) =>
{
Dictionary<string, object> jsonMessage = (Dictionary<string, object>)JsonFx.Json.JsonReader.Deserialize(response);
Dictionary<string, object> jsonData = (Dictionary<string, object>)jsonMessage["data"];

string heartbeatSeconds = jsonData["heartbeatSeconds"].ToString();

string logMessage = string.Join(" | ", new [] {heartbeatSeconds});
Debug.Log(logMessage); // 30
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("[EnableRTT Failed] {0} {1} {2}", status, code, error));
};
_bc.RTTService.EnableRTT(rttConnectionType, successCallback, failureCallback);
JSON Response
{
"service": "rtt",
"operation": "CONNECT",
"data": {
"heartbeatSeconds": 30
}
}