Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created October 20, 2021 10:39
Show Gist options
  • Save velotiotech/e86fa012ead2f3370eb859e11cd01022 to your computer and use it in GitHub Desktop.
Save velotiotech/e86fa012ead2f3370eb859e11cd01022 to your computer and use it in GitHub Desktop.
async unsubscribe() {
const topics = await this.getTopics();
if (!topics) {
throw Error(`Topics got undefined`);
}
return this.removeTopics({
[process.env.TOPICS_TABLE]: topics.map(({ topic, connectionId }) => ({
DeleteRequest: { Key: { topic, connectionId } },
})),
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment