Skip to content

Commit 36cc5eb

Browse files
committed
feat:Add publish events over websocket docs
1 parent 55c50de commit 36cc5eb

File tree

1 file changed

+8
-0
lines changed
  • src/pages/[platform]/build-a-backend/data/connect-event-api

1 file changed

+8
-0
lines changed

src/pages/[platform]/build-a-backend/data/connect-event-api/index.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ export default function App() {
8383

8484
async function publishEvent() {
8585
await events.post('default/channel', { some: 'data' });
86+
87+
//Alternative way to publish events through the channel
88+
const channel = await events.connect('default/channel');
89+
await channel.publish({ some: 'data' });
8690
}
8791

8892
return (
@@ -241,6 +245,10 @@ export default function App() {
241245

242246
async function publishEvent() {
243247
await events.post('default/channel', { some: 'data' });
248+
249+
//Alternative way to publish events through the channel
250+
const channel = await events.connect('default/channel');
251+
await channel.publish({ some: 'data' });
244252
}
245253

246254
return (

0 commit comments

Comments
 (0)