Created
March 12, 2021 01:58
-
-
Save onedebos/373fbbaef65720f582701cf3af8e8382 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { pusher } from "../../../lib/pusher"; | |
// presence channel handler | |
export default async function handler(req, res) { | |
const { message, username, userLocation } = req.body; | |
// trigger a new post event via pusher | |
await pusher.trigger("presence-channel", "chat-update", { | |
message, | |
username, | |
userLocation | |
}); | |
res.json({ status: 200 }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment