     #
     getAdditionalData: ->
         return @additionalData['customData']
-    #
-    # listener:
-    # on 'appstate', (result, state, additionaldata)
+
+    #
     # callback:
     #     (result, state, additionaldata)
     #

            'Accept': 'application/xml; charset=utf8'
        @_getState @serviceUrl, headers, (result, state) =>
            callback? result, state, @additionalData
            @emit 'appstate', result, state, @additionalData

    _getState: (url, headers, callback) ->
        @_request 'GET', url, headers, null, (statusCode, responseText) =>


class FlintSenderManager extends EventEmitter

    constructor: (@options) ->
        if not @options
            throw 'FlintSenderManager constructor error'

        @appId = @options.appId

        @urlBase = @options.urlBase
        @serviceUrl = @urlBase + '/apps/' + @appId
        @host = @options.host

        if @options.useHeartbeat is undefined
            @useHeartbeat = true
        else
            @useHeartbeat = @options.useHeartbeat

        @appState = {}
        @additionalData = {}
