How can I access/include "sessionIdentifier" in non-reserved mqtt topics with AWS IoT Core?

0

I need to access the "sessionIdentifier" in a regular topic, but cannot figure out how to include or access that in my lambda function that is mapped to the topic via event bridge/SQL as below:

      Events:
        UserTickedTTLRule:
          Type: 'IoTRule'
          Properties:
            AwsIotSqlVersion: '2016-03-23'
            Sql: !Sub "SELECT * FROM 'chat/+/ttl'"

How can I have "sessionIdentifier" included in the payload for a regular topic like this in my lambda function? Or how can I access it?

  • What do you mean by sesssionIdentifier? Is this something you are adding to the message you are sending?

  • @MassimilanoAWS it is a per-connection identifier that is included in all AWS Iot lifecycle events (https://docs.aws.amazon.com/iot/latest/developerguide/life-cycle-events.html - search "sessionIdentifier"). I am using it to track per-connection sessions on the application side of my architecture via dynamodb.

  • The problem is I have no way to access it outside a lifecycle event, and because aws does not include PING response as a lifecycle event, I need that identifier for building my own reconnection handling via a regular topic that my devices/clients publish a message to on a periodic basis, before keep-alive, in order to progressively delay the TTL for the dynamodb session record.

  • This is different than client_id, which is a session-level id used for device connection, I am looking for a connection-level id, e.g. if a client goes stale and does a keep-alive, it would get a new connection-level id, which from what i've figured out is what the sessionIdentifier is/does. This will allow me to build a mechanism to auto-cleanup dynamodb records per-connection if they never phone home (keep-alive). When they keep-alive happens they get a new sessionIdentifier (connection id) but same client_id (session id). Can email to discuss further.

borg
asked a year ago110 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions