Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created October 20, 2021 10:37
Show Gist options
  • Save velotiotech/a05239bf9e98ae5cd7b078eae7a67930 to your computer and use it in GitHub Desktop.
Save velotiotech/a05239bf9e98ae5cd7b078eae7a67930 to your computer and use it in GitHub Desktop.
async subscribe({ topic, ttl }) {
return dynamoDBClient
.put({
Item: {
topic,
connectionId: this.connectionId,
ttl: typeof ttl === 'number' ? ttl : Math.floor(Date.now() / 1000) + 60 * 60 * 2,
},
TableName: process.env.TOPICS_TABLE,
}).promise();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment