title: Events with Socket.io in iOS
body: <p>I am currently using the Socket.io client for swift, and I have been able to establish a connection to the server, but for some reason, I am unable to receive events. I have tried running it with debugging, and it receives the event from the iOS client, but it is not executing the addUser function. I'm missing something obvious, but I can't figure out what it is.</p>
  
  <p><strong>main.js</strong></p>
  
  <pre><code>var app = require('http').createServer()
  var io = require('socket.io')(app);
  app.listen(6979)
  
  io.on('connection', function(socket){
    console.log('a user connected');
    io.emit('hi there:');
  });
  
  io.on('addUser', function(username){
        console.log('ran addUser');
        io.emit(username);
        console.log(username);
   });
  </code></pre>
  
  <p><strong>Swift</strong> </p>
  
  <pre><code>import UIKit
  import Socket_IO_Client_Swift
  
  class ViewController: UIViewController {
      var name:String?
      let socket = SocketIOClient(socketURL: "http://xxx.xxx.xxx.xxx:6979", options: [.Log(true), .ForcePolling(true)])
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          // Do any additional setup after loading the view, typically from a nib.
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
      @IBAction func connect(sender: AnyObject) {
          socket.connect()
      }
  
      @IBAction func sendMessage(sender: AnyObject) {
  
      }
  
      @IBAction func sendUsername(sender: AnyObject) {
          let username = "yay"
          socket.emit("addUser", username)
      }
  }
  </code></pre>