File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/pages/[platform]/build-a-backend/data/connect-event-api Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,12 @@ export default function App() {
82
82
}, []);
83
83
84
84
async function publishEvent() {
85
+ // Publish via HTTP POST
85
86
await events .post (' default/channel' , { some: ' data' });
87
+
88
+ // Alternatively, publish events through the WebSocket channel
89
+ const channel = await events .connect (' default/channel' );
90
+ await channel .publish ({ some: ' data' });
86
91
}
87
92
88
93
return (
@@ -240,7 +245,12 @@ export default function App() {
240
245
}, []);
241
246
242
247
async function publishEvent() {
248
+ // Publish via HTTP POST
243
249
await events .post (' default/channel' , { some: ' data' });
250
+
251
+ // Alternatively, publish events through the WebSocket channel
252
+ const channel = await events .connect (' default/channel' );
253
+ await channel .publish ({ some: ' data' });
244
254
}
245
255
246
256
return (
You can’t perform that action at this time.
0 commit comments