             @sock.send JSON.stringify(acknowledgement), (error) ->
               if error?
                 console.error "Error sending acknowledgement for message '#{message.message_id}': #{error}\n#{error.stack}"
+              else
+                @emit 'acked', message.message_id
           catch error
             console.error "Invalid push message received: #{error}\n#{error.stack}"
 
         # WebSocket connection was rejected by the API
         @sock.on 'unexpected-response', (req, res) =>
-          @notify 'unexpected-response', [req, res]
+          @emit 'unexpected-response', [req, res]
 
           res.on 'data', (raw) ->
             try

    client_salt: cfg.client_key.salt
    timestamp: moment.utc().toISOString()

class PushWebSocket
  constructor: (@cfg, @namespace, @attributes, @eventHandler) ->
    @baseUrl = @cfg.base_ws_url
    @sock = null
    @pingerRef = null
    @messageCount = 0
    @lastMessageId = null

  disconnect: ->
    if @pingerRef?


        # The WebSocket was closed
        @sock.on 'close', =>
          if @autoReconnect == true and @initiatedClose != true
            @sock = null
            @connect().then ->
              console.log "Push WebSocket replaced for namespace '#{data.record.namespace}' topic [#{_(data.record.attributes).join(",")}]"

            @emit 'reconnect'
          else
            @emit 'close'
            console.log "Push WebSocket closed for namespace '#{data.record.namespace}' topic [#{_(data.record.attributes).join(",")}]"

        # The WebSocket connection has been established
        @sock.on 'open', =>
          @emit 'open'

          pinger = =>
            @sock.ping()
