 	private var lastParams: [NSURLQueryItem]?
 	private let queue = NSOperationQueue()
 
-	public var onSocketOpen: (() -> Void)?
-	public var onSocketError: ((code: Int, reason: String, wasClean: Bool, error: NSError?) -> Void)?
-	public var onSocketClose: ((code: Int, reason: String, wasClean: Bool) -> Void)?
-
-	public init(url: NSURL, heartbeatInterval: NSTimeInterval = 0.0) {
+	public init(url: NSURL, heartbeatInterval: NSTimeInterval = 0.0, reconnectInterval: NSTimeInterval = 5.0) {
 		self.url = url
 		self.heartbeatInterval = heartbeatInterval
+		self.reconnectInterval = reconnectInterval
 
 		queue.suspended = true
 	}

import SwiftWebSocket
import Wrap

public typealias SocketState = WebSocketReadyState

public final class Socket {
	public private(set) var socket: WebSocket?
	public let heartbeatInterval: NSTimeInterval
	public let url: NSURL
	public var reconnectOnError = true

	private var heartBeatTimer: NSTimer?
	private var reconnectTimer: NSTimer?

		socket = WebSocket(url: url.urlByAppendingQueryItems(params) ?? url)
		socket?.delegate = self
		socket?.open()
	}

	public func reconnect() {
