diff --git a/docs/channels/getting_started/javascript.md b/docs/channels/getting_started/javascript.md index e248a47..7ab2252 100644 --- a/docs/channels/getting_started/javascript.md +++ b/docs/channels/getting_started/javascript.md @@ -86,7 +86,7 @@ var pusher = new Pusher({ cluster: "APP_CLUSTER", }); -pusher.trigger("my-channel", "my-event", { message: "hello world" }); +await pusher.trigger("my-channel", "my-event", { message: "hello world" }); ``` ```php diff --git a/docs/channels/server_api/excluding-event-recipients.md b/docs/channels/server_api/excluding-event-recipients.md index fbf94a4..a0fcbec 100644 --- a/docs/channels/server_api/excluding-event-recipients.md +++ b/docs/channels/server_api/excluding-event-recipients.md @@ -118,9 +118,9 @@ const pusher = new Pusher({ useTLS: true, }); -app.post("/trigger", (req, res) => { +app.post("/trigger", async (req, res) => { const socketId = req.body.socket_id; - pusher.trigger( + await pusher.trigger( "my-channel", "my-event", { diff --git a/docs/channels/server_api/http-api.md b/docs/channels/server_api/http-api.md index 790fa7f..238a320 100644 --- a/docs/channels/server_api/http-api.md +++ b/docs/channels/server_api/http-api.md @@ -111,7 +111,7 @@ const pusher = new Pusher({ useTLS: true, }); -pusher.trigger(channels, event, data, socketId).catch((error) => { +await pusher.trigger(channels, event, data, socketId).catch((error) => { console.log(error); }); ``` @@ -358,7 +358,7 @@ const pusher = new Pusher({ cluster: "APP_CLUSTER", }); -pusher.trigger("my-channel", "my-event", { +await pusher.trigger("my-channel", "my-event", { message: "hello world", }); ``` @@ -453,7 +453,7 @@ const pusher = new Pusher({ }); const channels = ["my-channel-1", "my-channel-2", "my-channel-3"]; -pusher.trigger(channels, "my-event", { +await pusher.trigger(channels, "my-event", { message: "hello world", }); ``` @@ -600,7 +600,7 @@ const events = [ }, ]; -pusher.triggerBatch(events); +await pusher.triggerBatch(events); ``` ```py @@ -626,7 +626,7 @@ For the channels that were published to, you can request for the number of subsc This is currently only supported in the PHP, Node.js and Go SDKs. -{% snippets ['php', 'js', 'go'] %} +{% snippets ['php', 'node', 'go'] %} ```php $batch = array(); diff --git a/docs/channels/server_api/overview.md b/docs/channels/server_api/overview.md index e7018dd..2cf6246 100644 --- a/docs/channels/server_api/overview.md +++ b/docs/channels/server_api/overview.md @@ -115,7 +115,7 @@ const pusher = new Pusher({ useTLS: true, }); -pusher.trigger("my-channel", "my-event", { +await pusher.trigger("my-channel", "my-event", { message: "hello world", }); ``` diff --git a/docs/channels/server_api/server-to-user-messages.md b/docs/channels/server_api/server-to-user-messages.md index 71dad5b..b4aa1f8 100644 --- a/docs/channels/server_api/server-to-user-messages.md +++ b/docs/channels/server_api/server-to-user-messages.md @@ -19,10 +19,10 @@ Check: - The [Server user authentication docs](/docs/channels/server_api/authenticating-users) for information on how to create a user authentication endpoint. {% methodwrap %} -{% snippets ['js', 'php'], true %} +{% snippets ['node', 'php'], true %} ```js -pusher.sendToUser("user-id", "event-name", { message: "hello world" }); +await pusher.sendToUser("user-id", "event-name", { message: "hello world" }); ``` ```php