 private let FayeClientBayeuxMessageSupportedConnectionTypesKey = "supportedConnectionTypes"
 private let FayeClientBayeuxMessageConnectionTypeKey = "connectionType"
 
+private let FayeClientWebSocketErrorDomain = "com.nixWork.FayeClient.Error"
+
 // MARK: - Bayeux procotol messages
 
 extension FayeClient {

            completion?(finish: false)
        }
    }
}



        writeMessage(message)
    }

    func sendBayeuxPublishMessage(messageInfo: [String: AnyObject], withMessageUniqueID messageID: String, toChannel channel: String, usingExtension extension: [String: AnyObject]?) {

        guard isConnected && isWebSocketOpen else {
            didFailWithMessage("FayeClient not connected to server.")
            return
        }

        var message: [String: AnyObject] = [
            FayeClientBayeuxMessageChannelKey: channel,
            FayeClientBayeuxMessageClientIdKey: clientID,
            FayeClientBayeuxMessageDataKey: messageInfo,
            FayeClientBayeuxMessageIdKey: messageID,
        ]

        if let `extension` = `extension` {
            message[FayeClientBayeuxMessageExtensionKey] = `extension`

        } else {
            if let `extension` = channelExtensions[channel] {
                message[FayeClientBayeuxMessageExtensionKey] = `extension`
            }
        }

        writeMessage(message)
    }
}

// MARK: - SRWebSocket
