 typealias ChannelSubscriptionBlock = (NSDictionary) -> Void
 
 // MARK: FayeClientDelegate Protocol
-@objc protocol FayeClientDelegate{
-    optional func messageReceived(messageDict: NSDictionary, channel: String)
-    optional func connectedToServer()
-    optional func disconnectedFromServer()
-    optional func connectionFailed()
-    optional func didSubscribeToChannel(channel:String)
-    optional func didUnsubscribeFromChannel(channel:String)
-    optional func subscriptionFailedWithError(error:String)
-    optional func fayeClientError(error:NSError)
-}
+protocol FayeClientDelegate: NSObjectProtocol{
+    func messageReceived(messageDict: NSDictionary, channel: String)
+    func connectedToServer()
+    func disconnectedFromServer()
+    func connectionFailed()
+    func didSubscribeToChannel(channel:String)
+    func didUnsubscribeFromChannel(channel:String)
+    func subscriptionFailedWithError(error:String)
+    func fayeClientError(error:NSError)
+}
+
+extension FayeClientDelegate {
+    func messageReceived(messageDict: NSDictionary, channel: String){}
+    func connectedToServer(){}
+    func disconnectedFromServer(){}
+    func connectionFailed(){}
+    func didSubscribeToChannel(channel:String){}
+    func didUnsubscribeFromChannel(channel:String){}
+    func subscriptionFailedWithError(error:String){}
+    func fayeClientError(error:NSError){}
+}
+
 
 protocol Transport{
     func writeString(aString:String)

                        if let channelBlock = self.channelSubscriptionBlocks[channel]{
                            channelBlock(data as! NSDictionary)
                        }else{
                            self.delegate?.messageReceived?(data as! NSDictionary, channel: channel)
                        }
                        
                    }else{

                
                if let subscription = messageJSON[0]["subscription"].string{
                    self.openSubscriptions.removeObject(subscription)
                    self.delegate?.didUnsubscribeFromChannel(subscription)
                }else{
                    print("Missing subscription for Unsubscribe")
                }
