             return nil
         }
         super.init(url: url)
-        self.onConnect = websocketDidConnect
-        self.onDisconnect = websocketDidDisconnect
-        self.onData = websocketDidReceiveData
-        self.onText = websocketDidReceiveMessage
+        self.onConnect = onConnect
+        self.onDisconnect = onDisconnect
+        self.onData = onData
+        self.onText = onText
     }
 
     override func connect() {


     - parameter state: The state of the Speech to Text recognition request.
     */
    private func didReceiveState(state: SpeechToTextState) {
        if self.state == .ReceivingResults && state.state == "listening" {
            self.state = .Listening
            operations.suspended = false


     - parameter error: The error that occurred.
     */
    private func onError(error: SpeechToTextError) {
        state = .Listening
        let error = createError(SpeechToTextConstants.domain, description: error.error)
        failure?(error)
