Copy-Paste this into your terminal to send a message to this browser:
Connecting to a Realtime server ...
You just use the API and we take care of all the infrastructure to make it work around the world.
You can scale from one user to millions, we'll adapt automatically to your application needs.
A token-based security layer allows you to assign permissions to what your users can do.
Ready-to-use components will reduce your development time so you'll deploy sooner.
We'll help you adapt to future web protocols changes so you don't have to rewrite your code.
You'll pay as you go. We'll just charge you for what you use. From prototype to production.
Before you dive into your preferred SDK please take a few minutes to read this starting guide. For your convenience it’s divided into small sections that will guide you through the main concepts and best practices for optimal use of Realtime Cloud Messaging.
<script src="//messaging-public.realtime.co/js/2.1.0/ortc.js"></script> ... // Create Messaging client var client = RealtimeMessaging.createClient(); // Set client properties client.setClusterUrl('http://ortc-developers.realtime.co/server/2.1/'); client.onConnected = function (theClient) { // client is connected, subscribe a channel theClient.subscribe('myChannel', true, function (theClient, channel, msg) { console.log("Received message:", msg); }); }; client.onSubscribed = function (theClient, channel) { // Subscribed to the channel 'channel'); // Send a message to the channel theClient.send(channel, 'Hello World'); }; // Establish the connection client.connect('[YOUR_APPLICATION_KEY]', 'myAuthenticationToken');
import * as Realtime from 'realtime-messaging'; const realtime = Realtime.createClient(); realtime.setClusterUrl("https://ortc-developers.realtime.co/server/ssl/2.1/"); realtime.connect("YOUR_APPKEY", "SomeSecurityToken"); realtime.onConnected = onConnected; realtime.onException = onException; // Realtime connection is established onConnected(client: Realtime.Client) { // subscribe a channel to receive messages client.subscribeWithBuffer("myChannel", "SubscriberID", onMessage); } // A new message was received onMessage(client: Realtime.Client, channel: string, seqId: string, message: string) { console.log("Received message with seqId:", seqId, " message:", message); }
import { Component } from '@angular/core'; import * as Realtime from 'realtime-messaging'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { private realtime: Realtime.Client; constructor() { this.realtime = Realtime.createClient(); this.realtime.setClusterUrl("http://ortc-developers.realtime.co/server/2.1/"); this.realtime.connect("YOUR_APP_KEY", "SomeToken"); this.realtime.onConnected = (client) => { console.log("Connected to Realtime server"); this.realtime.subscribe(this.chatChannel, true, (client, channel, message) => { console.log("Received message on channel", channel, ":", message); }); } } }
- (void)viewDidLoad { [super viewDidLoad]; // Instantiate Messaging Client ortcClient = [OrtcClient ortcClientWithConfig:self]; // Set connection properties [ortcClient setConnectionMetadata:@"clientConnMeta"]; [ortcClient setClusterUrl:@"http://ortc-developers.realtime.co/server/2.1/"]; // Connect [ortcClient connect:@"[YOUR_APPLICATION_KEY]" authenticationToken:@"myAuthenticationToken"]; } - (void) onConnected:(OrtcClient*) ortc { // Messaging client is connected onMessage = ^(OrtcClient* ortc, NSString* channel, NSString* message) { // Received message 'message' at channel 'channel' }; // Subscribe messaging channel "myChannel" [ortcClient subscribe:@"myChannel" subscribeOnReconnected:YES onMessage:onMessage]; } - (void) onSubscribed:(OrtcClient*) ortc channel:(NSString*) channel { // Subscribed to the channel 'channel' // Send a message to the channel 'channel' [ortcClient send:channel message:@"Hello world"]; } @end
Cocoa Pod (without Push Notifications)
Cocoa Pod (with Push Notifications)
GitHub: Group-chat using iOS 10 Rich Push Notifications
GitHub: Swift group-chat using Push Notifications
Starting guide: Configuring Mobile Push Notifications (APNS)
import RealtimeMessaging_iOS_Swift class OrtcClass: NSObject, OrtcClientDelegate{ let APPKEY = "<INSERT_YOUR_APP_KEY>" let TOKEN = "guest" let METADATA = "swift example" let URL = "https://ortc-developers.realtime.co/server/ssl/2.1/" var ortc: OrtcClient? func connect() { self.ortc = OrtcClient.ortcClientWithConfig(self) self.ortc!.connectionMetadata = METADATA self.ortc!.clusterUrl = URL self.ortc!.connect(APPKEY, authenticationToken: TOKEN) } func onConnected(ortc: OrtcClient){ NSLog("CONNECTED") ortc.subscribe("SOME_CHANNEL", subscribeOnReconnected: true, onMessage: { (ortcClient:OrtcClient!, chn:String!, m:String!) -> Void in NSLog("Receive message: %@ on channel: %@", m!, chn!) }) } func onDisconnected(ortc: OrtcClient){ // Disconnected } func onSubscribed(ortc: OrtcClient, channel: String){ // Subscribed to the channel // Send a message ortc.send(channel, message: "Hello world!!!") } func onUnsubscribed(ortc: OrtcClient, channel: String){ // Unsubscribed from the channel 'channel' } func onException(ortc: OrtcClient, error: NSError){ // Exception occurred } func onReconnecting(ortc: OrtcClient){ // Reconnecting } func onReconnected(ortc: OrtcClient){ // Reconnected } }
Ortc api = new Ortc(); OrtcFactory factory = api.loadOrtcFactory("IbtRealtimeSJ"); final OrtcClient client = factory.createClient(); client.setClusterUrl("http://ortc-developers.realtime.co/server/2.1/"); client.onConnected = new OnConnected() { public void run(OrtcClient sender) { // Messaging client is connected // Subscribing 'myChannel' client.subscribe("myChannel", true, new OnMessage() { @Override public void run(OrtcClient sender, String channel, String message) { // Message received from channel } }); } }; client.onSubscribed = new OnSubscribed() { public void run(OrtcClient sender, String channel) { // Sending message to 'channel' ((OrtcClient) sender).send(channel, "Hello world"); } }; client.connect("[YOUR_APPLICATION_KEY]", "AUTHENTICATION_TOKEN");
var ortcNodeclient = require('ibtrealtimesjnode').IbtRealTimeSJNode; // Create Messaging client var ortcClient = new ortcNodeclient(); // Set Messaging client properties ortcClient.setConnectionMetadata('clientConnMeta'); ortcClient.setClusterUrl('http://ortc-developers.realtime.co/server/2.1/'); ortcClient.onConnected = function (ortc) { // Messaging client is connected ortcClient.subscribe('myChannel', true, function (ortc, channel, message) { // Received message: 'message' - at channel: 'channel' }); }; ortcClient.onSubscribed = function (ortc, channel) { // Subscribed to the channel 'channel'; // Sending HelloWorld message ortcClient.send(channel, 'Hello World'); }; ortcClient.connect('[YOUR_APPLICATION_KEY]', 'myAuthenticationToken');
var ortcClient:OrtcClient = new OrtcClient(); ortcClient.connectionMetadata = "clientConnMeta"; ortcClient.clusterUrl = "http://ortc-developers.realtime.co/server/2.1/"; ortcClient.onConnected = function (ortc:OrtcClient):void { // Messaging client is connected ortcClient.subscribe("myChannel", true, function (ortc:OrtcClient, channel:String, message:String):void { // Received message 'message' at channel 'channel' }); }; ortcClient.onSubscribed = function (ortc:OrtcClient, channel:String):void { // Subscribed to the channel 'channel' // Sending Hello World Message ortcClient.send(channel, "Hello World"); }; ortcClient.connect("[YOUR_APPLICATION_KEY]", "myAuthenticationToken");
curl -d "AK=[APP_KEY]&PK=[PRIVATE_KEY]&C=myChannel&M=3c261a88_1-1_HelloWorld" https://ortc-developers2-useast1-s0001.realtime.co/send
OrtcFactory factory; final OrtcClient client; Ortc ortc = new Ortc(); factory = ortc.loadOrtcFactory("IbtRealtimeSJ"); client = factory.createClient(); client.setClusterUrl("http://ortc-developers.realtime.co/server/2.1/"); client.setConnectionMetadata("AndroidApp"); client.onConnected = new OnConnected() { @Override public void run(final OrtcClient sender) { // Messaging client connected runOnUiThread(new Runnable() { @Override public void run() { // Subscribe channel "myChannel" client.subscribe("myChannel", true, new OnMessage() { public void run(OrtcClient sender, String channel, String message) { // Received 'message' from 'channel' }; } ); } }); } }; client.onSubscribed = new OnSubscribed() { @Override public void run(OrtcClient sender, String channel) { runOnUiThread(new Runnable() { @Override public void run() { // Sending Hello World message client.send("myChannel", "Hello World"); } }); } }; client.connect("[YOUR_APPLICATION_KEY]", "myToken");
var tessel = require('tessel'); var led1 = tessel.led[0].output(1); var ortcNodeclient = require('realtime-tessel').Messaging; var ortcClient = new ortcNodeclient(); ortcClient.setClusterUrl('http://ortc-developers.realtime.co/server/2.1/'); ortcClient.onConnected = function (ortc) { // Subscribe channel tessel to receive remote commands ortcClient.subscribe('tessel', true, function (ortc, channel, message) { console.log('Received a new message: ' + message); led1.toggle(); }); }; ortcClient.onException = function (ortc, exception) { console.log('exception: ' + exception); }; ortcClient.connect('YOUR_APPLICATION_KEY', 'myAuthenticationToken');
var ortc = require('co.realtime.ortc'); ortc.addEventListener('onConnected', function(e) { // Connected ortc.subscribe("myChannel", true); }); ortc.addEventListener('onSubscribed', function(e) { // Sending Hello World Message ortc.send(e.channel, "Hello World"); }); ortc.addEventListener('onMessage', function(e) { // Received e.message from e.channel }); var win = Titanium.UI.createWindow({ title:'ORTC example', backgroundColor:'#fff' }); var btConnect = Titanium.UI.createButton({ title:'Connect', top: '3%', left: '3%', width: '30%', height: '8%' }); btConnect.addEventListener('click', function(e) { ortc.connectionMetadata = 'Titanium example'; ortc.clusterUrl = 'http://ortc-developers.realtime.co/server/2.1'; ortc.connect("[YOUR_APPLICATION_KEY]", "myToken"); }); win.add(btConnect); win.open();
#include <stdio.h> #include "libortc.h" #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) #include "Windows.h" #endif #define ORTC_CLUSTER "http://ortc-developers.realtime.co/server/2.1" #define ORTC_APP_KEY "your_application_key" #define ORTC_AUTH_TOKEN "your_authentication_token" int isWaiting; void onMessage(ortc_context *context, char* channel, char* message) { printf("Received Message (at %s): %s\n", channel, message); isWaiting = 0; } void onConnected(ortc_context *context) { printf("Connected!!!\n"); // Subscribe channel "MyChannel" ortc_subscribe(context, "myChannel", 1, onMessage); } void onSubscribed(ortc_context *context, char* channel) { printf("Subscribed to channel: %s\n", channel); // Send Hello World message ortc_send(context, channel, "Hello World"); } int main(void) { ortc_context *context; isWaiting = 1; context = ortc_create_context(); ortc_set_cluster(context, ORTC_CLUSTER); ortc_set_onConnected (context, onConnected); ortc_set_onSubscribed (context, onSubscribed); ortc_connect(context, ORTC_APP_KEY, ORTC_AUTH_TOKEN); while(isWaiting) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) Sleep(1000); #else sleep(1); #endif ortc_free_context(context); }
OrtcClient *ortc; void HelloWorld::connect(Ref* pSender, cocos2d::ui::Widget::TouchEventType type){ ortc = new OrtcClient(this); ortc->setCluster(new std::string("http://ortc-developers.realtime.co/server/2.1")); ortc->connect(new std::string(ORTC_APP_KEY), new std::string(ORTC_AUTH_TOKEN)); } void HelloWorld::onConnect(OrtcClient* ortc){ CCLOG("Connected"); ortc->subscribe(new std::string("myChannel"), true); } void HelloWorld::onSubscribe(OrtcClient* ortc, std::string* channel){ CCLOG("Subscribe channel: %s", channel->c_str()); std::string *message = new std::string("Hello World!"); ortc->sendMessage(channel, message); } void HelloWorld::onMessage(OrtcClient*, std::string *message, std::string *channel){ CCLOG("message: %s from channel: %s", message->c_str(), channel->c_str()); }
using System; using System.Threading.Tasks; using RealtimeMessaging.DotNetCore; using RealtimeMessaging.DotNetCore.Extensibility; namespace RTMCore { class Program { static void Main(string[] args) { var p = new Program(); p.Start().Wait(); while (true) { } } private OrtcClient ortcClient; public async Task Start() { var api = new Ortc(); IOrtcFactory factory = api.LoadOrtcFactory("RealTimeSJ"); ortcClient = factory.CreateClient(); ortcClient.ClusterUrl = "http://ortc-developers.realtime.co/server/2.1/"; ortcClient.ConnectionMetadata = "myConnectionMetadata"; ortcClient.OnConnected += new OnConnectedDelegate(ortc_OnConnected); ortcClient.OnSubscribed += new OnSubscribedDelegate(ortc_OnSubscribed); ortcClient.OnException += new OnExceptionDelegate(ortc_OnException); Console.Out.WriteLine("connecting"); await ortcClient.Connect("[YOUR_APPLICATION_KEY]", "myToken"); } private void ortc_OnConnected(object sender) { ortcClient.Subscribe("myChannel", true, (object ortc, string channel, string message) => { Console.Out.WriteLine(string.Format("received message: {0}", message)); }); } private void ortc_OnSubscribed(object sender, string channel) { Console.Out.WriteLine(string.Format("subscribed channel:{0}", channel)); ortcClient.Send(channel, "Hello world!!!"); } private void ortc_OnException(object sender, Exception ex) { Console.Out.WriteLine(string.Format("OnException:{0}", ex.ToString())); } } }
error_reporting(E_ALL); session_start(); require('./ortc.php'); $URL = 'http://ortc-developers.realtime.co/server/2.1'; $AK = 'YOUR_APPLICATION_KEY'; $PK = 'YOUR_APPLICATION_PRIVATE_KEY'; $TK = 'dummyToken'; // token can be randomly generated $CH = 'myChannel'; // Authenticating a token with write (w) permissions on myChannel if( ! array_key_exists('ortc_token', $_SESSION) ){ $_SESSION['ortc_token'] = $TK; $rt = new Realtime( $URL, $AK, $PK, $TK ); $ttl = 180000; $result = $rt->auth( array( $CH => 'w' ), 0, $ttl ); print '<!-- auth status '.( $result ? 'ok' : 'fail' ).' -->\n'; } // Send Hello World message $result = $rt->send($CH, "Hello World", $response); print '<!-- send status '.( $result ? 'ok' : 'fail' ).' -->\n';
#!/usr/bin/python # -*- coding: utf-8 -*- import ortc import time ortc_client = ortc.OrtcClient() def on_connected(sender): print 'Connected' ortc_client.subscribe('myChannel', True, on_message) def on_message(sender, channel, message): print r'Message received ('+channel+'): ' + message def on_subscribed(sender, channel): print 'Send Hello World message' ortc_client.send(channel, 'Hello World') ortc_client.set_on_connected_callback(on_connected) ortc_client.set_on_subscribed_callback(on_subscribed) ortc_client.cluster_url = "http://ortc-developers.realtime.co/server/2.1" ortc_client.connect('[YOUR_APPLICATION_KEY]') try: while True: time.sleep(1) except: pass
--ORTC_LIB_PATH = "./lib" require("OrtcClient") local ortcClient = OrtcClient:new{} local url = "http://ortc-developers.realtime.co/server/2.1/" local appKey = "YOUR_APPLICATION_KEY" local authToken = "YOUR_AUTHENTICATION_TOKEN" local channel = "MyChannel" local message = "hello world!" local function doLog (text) if text ~= nil then print(os.date("%H:%M:%S").." - "..tostring(text)) end end local function doSubscribe () doLog("Subscribing to: "..channel.."...") local function onMessage (obj, chn, msg) doLog("Received at "..chn..": "..msg) end ortcClient:subscribe(channel, true, onMessage) end local function onConnected (obj) doLog("Connected to: "..obj.url) doSubscribe() end local function onSubscribed (obj, chn) doLog("Subscribed to: "..chn) doLog("Send message: "..message.." - to channel: "..chn) ortcClient:send(chn, message) end ortcClient.id = "LuaId" ortcClient.connectionMetadata = "UserConnectionMetadata" ortcClient.clusterUrl = url ortcClient.onConnected = onConnected ortcClient.onSubscribed = onSubscribed doLog("Connecting to: "..url.."...") ortcClient:connect(appKey, authToken)
require "./ortc.rb" ortc_client = ORTC::OrtcClient.new ortc_client.cluster_url = 'http://ortc-developers.realtime.co/server/2.1' @mc = lambda {|sender, channel, message| puts "cb: #{message}"} ortc_client.on_connected do |sender| p [:Connected] ortc_client.subscribe("myChannel", true) {|sender, channel, message| @mc.call sender, channel, message } end ortc_client.on_subscribed do |sender, channel| p [:Subscribed, channel] ortc_client.send(channel, 'Hello World') end ortc_client.connect 'YOUR_APPLICATION_KEY', 'YOUR_TOKEN' loop do sleep 1 end
// Construct object _ortc = OrtcFactory.Create(); // Handlers _ortc.OnConnected += ortc_OnConnected; _ortc.OnDisconnected += ortc_OnDisconnected; _ortc.OnReconnecting += ortc_OnReconnecting; _ortc.OnReconnected += ortc_OnReconnected; _ortc.OnSubscribed += ortc_OnSubscribed; _ortc.OnUnsubscribed += ortc_OnUnsubscribed; _ortc.OnException += ortc_OnException; // Connect public string URL = "http://ortc-developers.realtime.co/server/2.1"; public string URLSSL = "https://ortc-developers.realtime.co/server/ssl/2.1"; // Use cluster unless server is private if (ClientIsCluster) { _ortc.ClusterUrl = URL; } else { _ortc.Url = URL; } // Metadata should be a username or user id _ortc.ConnectionMetadata = ClientMetaData; _ortc.HeartbeatActive = Heartbeat; _ortc.Connect(ApplicationKey, AuthToken); // Subscribe channel _ortc.Subscribe(Channel, true, OnMessageCallback); private void OnMessageCallback(string channel, string message) { } // Send message _ortc.Send("Channel", "Message");
string applicationKey = "myApplicationKey"; string authenticationToken = "myAuthenticationToken"; // Create ORTC client OrtcClient ortcClient = new RealtimeFramework.Messaging.OrtcClient(); ortcClient.ClusterUrl = "http://ortc-developers.realtime.co/server/2.1/"; // Ortc client handlers ortcClient.OnConnected += new OnConnectedDelegate(ortc_OnConnected); ortcClient.OnSubscribed += new OnSubscribedDelegate(ortc_OnSubscribed); ortcClient.OnException += new OnExceptionDelegate(ortc_OnException); ortcClient.connect(applicationKey, authenticationToken); private void ortc_OnConnected(object sender) { ortcClient.Subscribe("channel1", true, OnMessageCallback); } private void OnMessageCallback(object sender, string channel, string message) { System.Diagnostics.Debug.Writeline("Message received: " + message); } private void ortc_OnSubscribed(object sender, string channel) { ortcClient.Send(channel, "your message"); } private void ortc_OnException(object sender, Exception ex) { System.Diagnostics.Debug.Writeline(ex.Message); }
function subscribe() { if(window.plugins && window.plugins.OrtcPushPlugin){ var OrtcPushPlugin = window.plugins.OrtcPushPlugin; OrtcPushPlugin.log("Connecting"); OrtcPushPlugin.connect({ 'appkey':'YOUR_APPLICATION_KEY', 'token':'myToken', 'metadata':'myMetadata', 'url':'https://ortc-developers.realtime.co/server/ssl/2.1/', 'projectId':'YOUR_GOOGLE_PROJECT_NUMBER' }, function (){ OrtcPushPlugin.log("Connected: "); var channel = document.getElementById('channel'); OrtcPushPlugin.log("Trying to subscribe: " + channel.value); OrtcPushPlugin.subscribe({ 'channel':channel.value }, function (){ var subscribed = document.getElementById('subscribed'); subscribed.innerHTML = "subscribed: " + channel.value; OrtcPushPlugin.log("subscribed: " + channel.value); }); }); } } document.addEventListener("push-notification", function(notification) { window.plugins.OrtcPushPlugin.log(notification.payload); var payload = document.getElementById('payload'); payload.innerHTML = "payload: " + notification.payload.name; payload.value = "payload: " + notification.payload.name; }, false)
var OrtcPushPlugin = window['plugins'].OrtcPushPlugin; OrtcPushPlugin.connect({ 'appkey':'YOUR-APPKEY-HERE', 'token':'appToken', 'metadata':'androidMetadata', 'projectId':'YOUR-FIREBASE-SENDER-ID-HERE', 'url':'https://ortc-developers.realtime.co/server/ssl/2.1/' }).then(() => { console.log("connected"); OrtcPushPlugin.subscribe({ 'channel': channel }).then(() => { console.log("subscribed channel"); }); }); document.addEventListener("push-notification", function(notification) { console.log("received notification: ", notification); }, false);
function subscribe() { if(window.plugins && window.plugins.OrtcPushPlugin){ var OrtcPushPlugin = window.plugins.OrtcPushPlugin; OrtcPushPlugin.log("Connecting"); OrtcPushPlugin.connect({ 'appkey':'YOUR_APPLICATION_KEY', 'token':'myToken', 'metadata':'myMetadata', 'url':'https://ortc-developers.realtime.co/server/ssl/2.1/', 'projectId':'YOUR_GOOGLE_PROJECT_NUMBER' }, function (){ OrtcPushPlugin.log("Connected: "); var channel = document.getElementById('channel'); OrtcPushPlugin.log("Trying to subscribe: " + channel.value); OrtcPushPlugin.subscribe({ 'channel':channel.value }, function (){ var subscribed = document.getElementById('subscribed'); subscribed.innerHTML = "subscribed: " + channel.value; OrtcPushPlugin.log("subscribed: " + channel.value); }); }); } } document.addEventListener("push-notification", function(notification) { window.plugins.OrtcPushPlugin.log(notification.payload); var payload = document.getElementById('payload'); payload.innerHTML = "payload: " + notification.payload.name; payload.value = "payload: " + notification.payload.name; }, false)
// Sample project main.go package main import ( "bufio" "fmt" "github.com/realtime-framework/RealtimeMessaging-Go" "os" ) const defaultServerUrl = "http://ortc-developers.realtime.co/server/2.1" const defaultIsCluster = true const defaultApplicationKey = "YOUR_APPLICATION_KEY" const defaultPrivateKey = "YOUR_PRIVATE_KEY" const defaultAuthenticationToken = "myToken" const defaultNeedsAuthentication = false const defaultMetadata = "GoApp" func main() { //Creates a new Ortc client instance with the respective channels events. client, onConnected, onDisconnected, onException, onMessage, onReconnected, onReconnecting, onSubscribed, onUnsubscribed := ortc.NewOrtcClient() //Read from the Ortc events channels. go func() { for { select { case sender := <-onConnected: fmt.Println("CLIENT CONNECTED TO: " + sender.GetUrl()) client.Subscribe("my_channel", true) case sender := <-onDisconnected: fmt.Println("CLIENT DISCONNECTED FROM: " + sender.GetUrl()) case sender := <-onException: fmt.Println("CLIENT EXCEPTION: " + sender.Err) case msgObj := <-onMessage: fmt.Println("RECEIVED MESSAGE: " + msgObj.Message + " ON CHANNEL: " + msgObj.Channel) case sender := <-onReconnected: fmt.Println("CLIENT RECONNECTED TO: " + sender.GetUrl()) case sender := <-onReconnecting: fmt.Println("CLIENT RECONNECTING TO: " + sender.GetUrl()) case sender := <-onSubscribed: fmt.Println("CLIENT SUBSCRIBED TO: " + sender.Channel) client.Send("my_channel", "Hello World!") case sender := <-onUnsubscribed: fmt.Println("CLIENT UNSUBSCRIBED FROM: " + sender.Channel) } } }() //Connects the client to the Ortc client.Connect(defaultApplicationKey, defaultAuthenticationToken, defaultMetadata, defaultServerUrl, defaultIsCluster, defaultNeedsAuthentication) fmt.Println("Press Enter to Exit") consolereader := bufio.NewReader(os.Stdin) _, err := consolereader.ReadString('\n') if err != nil { fmt.Println(err) os.Exit(1) } }
import React, { Component } from 'react'; import Realtime from 'realtime-messaging'; class App extends Component { componentWillMount() { // Instantiate a Realtime client Realtime.loadOrtcFactory(Realtime.IbtRealTimeSJType, (factory, error) => { if(!error) { this.realtime = factory.createClient(); this.realtime.onConnected = (client) => { console.log("realtime connected"); // subscribe a channel to receive messages client.subscribe("myChannel", true, (client, channel, message) => { console.log("Received message:", message); }); } this.realtime.setClusterUrl("http://ortc-developers.realtime.co/server/2.1/"); this.realtime.connect('ENTER-HERE-YOUR-REALTIME-APPKEY', 'token'); } }); } render() { return ( <div> <SomeOtherReactComponent realtime={ this.realtime } /> </div> ); } } export default App;
'use strict'; var React = require('react-native'); var module = require('RCTRealtimeMessagingIOS'); var RCTRealtimeMessaging = new module(); var { AppRegistry, StyleSheet, Navigator, ScrollView, } = React; var RealtimeRCT = React.createClass({ doConnect: function(){ // Connecting ... RCTRealtimeMessaging.RTEventListener("onConnected",this._onConnected), RCTRealtimeMessaging.RTConnect( { appKey: "YOUR_APP_KEY", token: "TOKEN", connectionMetadata: "A REACT NATIVE CLIENT", clusterUrl: "http://ortc-developers.realtime.co/server/2.1/" }); }, componentDidMount: function() { this.doConnect(); }, _onConnected: function() { // Connected. Send a message ... RCTRealtimeMessaging.RTSendMessage("Hello World", "MyChannel"); }, render: function() { return ()} }); var styles = StyleSheet.create({ container: { marginTop: 30, margin: 5, backgroundColor: '#FFFFFF', }, }); AppRegistry.registerComponent('RealtimeRCT', () => RealtimeRCT);
string applicationKey = "yourApplicationKey"; string authenticationToken = "yourAuthenticationToken"; // Create ORTC client OrtcClient ortcClient = new RealtimeFramework.Messaging.OrtcClient(); ortcClient.ClusterUrl = "http://ortc-developers.realtime.co/server/2.1/"; // Ortc client handlers ortcClient.OnConnected += new OnConnectedDelegate(ortc_OnConnected); ortcClient.OnSubscribed += new OnSubscribedDelegate(ortc_OnSubscribed); ortcClient.OnException += new OnExceptionDelegate(ortc_OnException); ortcClient.connect(applicationKey, authenticationToken); private void ortc_OnConnected(object sender) { ortcClient.Subscribe("MyChannel", true, OnMessageCallback); } private void OnMessageCallback(object sender, string channel, string message) { System.Diagnostics.Debug.Writeline("Message received: " + message); } private void ortc_OnSubscribed(object sender, string channel) { ortcClient.Send(channel, "Hello world"); } private void ortc_OnException(object sender, Exception ex) { System.Diagnostics.Debug.Writeline(ex.Message); }
up to 100 simultaneous connections
max 25 million messages
max 30,000 user sessions
SSL protection
unlimited channels
2 minutes message retention
up to 3,000 simultaneous connections
$1 per million messages above 31 millions
SSL protection
unlimited channels
3 days message retention
up to 10,000 simultaneous connections
$1 per million messages above 101 millions
SSL protection
unlimited channels
3 days message retention
up to 25,000 simultaneous connections
$1 per million messages above 251 millions
SSL protection
unlimited channels
3 days message retention
unlimited simultaneous connections
$1 per million messages
option of private infrastructure
SSL protection
unlimited channels
3 days message retention
The Realtime Framework supports numerous use cases for collaborative applications.
From media websites to social apps, we're proud to say we've seen it all since our launch in 2011.
What if you need to persist the transmitted data while sending it in realtime? The Realtime Cloud Storage Service is a highly-scalable NoSQL cloud database with built-in real-time notifications to keep your data synchronized between users.
+ Read moreUsing Realtime Webhooks with AWS Lambda
Using Messaging Webhooks with Realtime Code Hosting
Using iOS 10 Rich Push Notifications
Our cloud services are constantly monitored and we are proud of our services high-availability.