     username:     undefined
     color:        undefined
 
+    # Registers callbacks for events
     constructor: (@host, @username, @color) ->
       @net = new netClient @host
 

      initialized = true
      @emit types.initialized

    acknowledge: (ack) =>
      for i in [0...@notAcked.length]
        if @notAcked[i].state[@id] is ack[@id]

    handleEnd: =>
      @emit 'end'

    handleServerDown: =>
      @emit 'error', 'Server down'

    # The server has send information for initialization.
    # The state and the client id have been send and will be set.
    # For each client already sharing a new cursor is created.
    # Emit an event for signaling the connection is established.
    initialize: (transform) =>
      @emit types.clear
      @id       = transform.clientId
