Ios 如何在Swift上使用红蜘蛛从Pusher处获得活动?

Ios 如何在Swift上使用红蜘蛛从Pusher处获得活动?,ios,swift,websocket,pusher,Ios,Swift,Websocket,Pusher,我正在尝试为我的iOS应用程序使用Pusher。我将红蜘蛛.framework作为客户端安装到我的应用程序中。我能够连接到特定推送者的应用程序。我还可以通过点击我的应用程序上的一个按钮来断开连接。我可以从Pusher的调试控制台观看这些活动和日志 但是,如果我从调试控制台创建新事件,我的iOS应用程序将不会收到它的事件。“websocketDidReceiveMessage”功能将不起作用 我认为我犯了错误。如果有什么错误,请告诉我 致以最良好的祝愿 这是我的密码 import UIKit im

我正在尝试为我的iOS应用程序使用Pusher。我将红蜘蛛.framework作为客户端安装到我的应用程序中。我能够连接到特定推送者的应用程序。我还可以通过点击我的应用程序上的一个按钮来断开连接。我可以从Pusher的调试控制台观看这些活动和日志

但是,如果我从调试控制台创建新事件,我的iOS应用程序将不会收到它的事件。“websocketDidReceiveMessage”功能将不起作用

我认为我犯了错误。如果有什么错误,请告诉我

致以最良好的祝愿

这是我的密码

import UIKit
import Parse
import Starscream

class ViewController: UIViewController, WebSocketDelegate {


var socket = WebSocket(url: NSURL(scheme: "ws", host: "ws.pusherapp.com/app/API_KEY?protocol=7", path: "/")!)


override func viewDidLoad() {
    super.viewDidLoad()

    self.socket.delegate = self
    self.socket.connect()

}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}



@IBAction func disconnectWasTapped(sender: UIButton) {
    self.socket.disconnect()
}


// MARK: WebSocket
func websocketDidConnect(socket: WebSocket) {
    println("websocket is connected")
}

func websocketDidDisconnect(socket: WebSocket, error: NSError?) {
    println("websocket is disconnected: \(error?.localizedDescription)")
}

func websocketDidReceiveMessage(socket: WebSocket, text: String) {
    //println("got some text!!")
    println("got some text: \(text)")
}

func websocketDidReceiveData(socket: WebSocket, data: NSData) {
    println("got some data: \(data.length)")
}


}
更新 我能自己解决我的问题。我决定不使用推进器。我决定用PubNub代替Pusher。现在正在研制Swift。而且它很容易与Parse集成以实现实时通信