Skip to content

Instantly share code, notes, and snippets.

@lukejoshuapark
Created August 15, 2022 02:38
Show Gist options
  • Save lukejoshuapark/9d6f462bdc4c46ed016503e7ea112a85 to your computer and use it in GitHub Desktop.
Save lukejoshuapark/9d6f462bdc4c46ed016503e7ea112a85 to your computer and use it in GitHub Desktop.
app.post("/callback", async (req, res) => {
res.status(204);
res.send();
// Remember to include security checks here - see the documentation
// for more information.
const { action, referenceId, payload } = req.body;
switch (action) {
case "CONNECT":
console.log("User", referenceId, "connected!");
break;
case "DISCONNECT":
console.log("User", referenceId, "disconnected!");
break;
case "MESSAGE":
console.log("User", referenceId, "sent", payload);
break;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment