2016-11-28 3 views
1

나는 SwiftR을 사용하여 신속하게 signalR 채팅 클라이언트를 통합하고 있습니다. 내 obj-c 코드를 단계별로 신속하게 변환했습니다. callaback 메소드에서 응답으로 얻는 것이 없습니다. 콜백 내에서 브레이크 포인트를 치지도 않습니다.신속한 채팅 클라이언트 업데이트

  SwiftR.connect("https://chat.f.com") { connection in 
     connection.headers=["Authorization":bearerKey] 

     self.chatHub = connection.createHubProxy("MobileChatHub") 

     self.chatHub?.on("ChatContactsResponse", callback: { (response) in 
      print("ChatContactsResponse") 
      print(response as AnyObject) 
     }) 
     self.chatHub?.on("GetChatsResponse", callback: { (response) in 
      print("GetChatsResponse") 
      print(response as AnyObject) 
     }) 
     self.chatHub?.on("GetChatsResponse", callback: { (response) in 
      print("GetChatsResponse") 
      print(response as AnyObject) 
     }) 

     connection.starting = { print("started")} 
     connection.connected = { print("connected: \(connection.connectionID)") } 
     connection.connectionSlow = { print("connectionSlow") } 
     connection.reconnecting = { print("reconnecting") } 
     connection.reconnected = { print("reconnected") } 
     connection.disconnected = { print("disconnected")} 
    } 
+0

Swift/Objective-C 클라이언트를 모르지만 일반적으로 SignalR 서버는 연결이 시작될 때 허브를 알아야합니다. 이 코드를 올바르게 읽으면 먼저 연결을 시작한 다음 허브 프록시를 만듭니다. 먼저 프록시를 만든 다음 연결을 시작 했습니까? 이렇게하면 클라이언트는 사용할 허브에 대해 알게되고 연결을 시작할 때 connectionData로 서버에 보낼 것입니다. – Pawel

답변

1

당신이 옳은 일을하고 있습니다. 당신이 다음 #127 line here을 찾을 this 데모로 찾는 경우

는하지만 connection.start() 를 분실했습니다.

관련 문제