 
 import UIKit
 
+enum AppEvents: String, Printable {
+    case TicketCall = "TicketCall"
+    
+    var description: String {
+        return self.rawValue
+    }
+}
+
 class TicketsViewController: PageViewController {
     
     let tableView = UITableView()
     let ticketCellIdentifier = "TicketCell"
-    let items = ["A", "B" , "C"]
+    var items = ["A", "B" , "C"]
+    
+    let socket = SocketIO<AppEvents>(url: "http://smartime.herokuapp.com")
     
     init() {
         super.init(nibName: nil, bundle: nil)

    
    func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        // Select row
        items.map({ $0 + " - Done" }).flatMap({ value -> Array<String> in println(value); return items })
        
        tableView.deselectRowAtIndexPath(indexPath, animated: true)
    }
    
}

        tableView.delegate = self
        tableView.separatorStyle = UITableViewCellSeparatorStyle.None
        tableView.showsVerticalScrollIndicator = false
        
        socket.on(.ConnectError) {
            switch $0 {
            case .Failure(let error):
                println(error)
            default:
                break
            }
        }.on(.Connected) { (arg: SocketIOArg) -> () in
            println("Connected")
        }.on(.Disconnected) {
            switch $0 {
            case .Message(let message):
                println("Disconnected with no error")
            case .Failure(let error):
                println("Disconnected with error: \(error)")
            default:
                break
            }
        }
        
        socket.on(.TicketCall) {
            switch $0 {
            case .Message(let message):
                println("Mensagem recebida: \(message)")
            default:
                break
            }
        }
        
        //socket.connect()
    }
    
    required init(coder aDecoder: NSCoder) {
