Classes

The following classes are available globally.

  • *Part of the The Realtime® Framework, Realtime Cloud Messaging (aka ORTC) is a secure, fast and highly scalable cloud-hosted Pub/Sub real-time message broker for web and mobile apps. * *If your website or mobile app has data that needs to be updated in the user’s interface as it changes (e.g. real-time stock quotes or ever changing social news feed) Realtime Cloud Messaging is the reliable, easy, unbelievably fast, “works everywhere” solution.

    Example:

    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!, channel:String!, message:String!) -> Void in
    NSLog("Receive message: %@ on channel: %@", message!, channel!)
    })
    }
    
    func onDisconnected(ortc: OrtcClient){
    // Disconnected
    }
    
    func onSubscribed(ortc: OrtcClient, channel: String){
    // Subscribed to the channel
    
    // Send a message
    ortc.send(channel, "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
    }
    }
    
    See more

    Declaration

    Swift

    open class OrtcClient: NSObject, WebSocketDelegate