       url  = "ws://#{host}:#{port}/socket.io/websocket"
       @ws = new WebSocket(url)
       @ws.onmessage = @onMessage.bind(@)
-      @ws.onerror = @onError.bind(@)
+      @ws.onerror = @disconnect.bind(@)
       @ws.onclose = @onClose.bind(@)
 
   whichServer: (roomid, callback) ->

      success : true


  onError: (data) ->
    @emit 'error', data


  onClose: ->

          callback.call(@, host, port)
        else
          @log "Failed to determine which server to use: #{dataStr}"
          @disconnect new Error 'Error parsing server response'
    .on 'error', (e) =>
      @log "whichServer error: #{e}"
      @disconnect e


  setTmpSong: (data) ->
