 
 		}
 
-		onSocketClose?(code: code, reason: reason, wasClean: wasClean)
+		onClose?(code: code, reason: reason, wasClean: wasClean)
 	}
 
 	private func webSocketDidError(error: NSError) {
 		queue.suspended = true
 		discardHeartBeatTimer()
 
-		onSocketError?(error: error)
+		onError?(error: error)
 
 		webSocketDidClose(
 			code: error.code,

				)
			}

			onSocketMessage?(result: .Success(message))
		} catch let error as NSError {
			webSocketDidError(error)
			onSocketMessage?(result: .Failure(error))
		}
	}
	

	public let url: NSURL
	public var reconnectOnError = true

	/// <#Description#>
	public var onOpen: (() -> Void)?
	/// <#Description#>
	public var onError: ((error: NSError) -> Void)?
	/// <#Description#>
	public var onClose: ((code: Int, reason: String, wasClean: Bool) -> Void)?
	/// <#Description#>
	public var onMessage: ((result: Result<Message>) -> Void)?

	public var socketState: SocketState {
		return socket?.readyState ?? .Closed
