 
   # ready states:
   [ NOTREADY, READY, CLOSED ] = [0,1,3]
+
+  # error states:
+  [ OKAY, ERROR ] = [0,1]
 
   uniqueId = "#{ Math.random() }" 
 

    # enable below to autoReconnect when the socket has been closed
    if @autoReconnect
      process.nextTick => @setBackoffTimeout @bound "connect"
    @emit 'info', "#{ @options.url }: disconnected, trying to reconnect..."
    return


    @proto.handle req  if req?
    return

  onError: (err) ->
    @errState = ERROR
    @emit 'info', "#{ @options.url } error: #{ err.data }"
    return

  wrapMessage: (method, params, callback) ->
    authentication    : @options.authentication
    withArgs          : params
    responseCallback  : (response) ->
      { withArgs:[{ error: err, result }]} = response
