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() {
8282 }, []);
8383
8484 async function publishEvent() {
85+ // Publish via HTTP POST
8586 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' });
8691 }
8792
8893 return (
@@ -240,7 +245,12 @@ export default function App() {
240245 }, []);
241246
242247 async function publishEvent() {
248+ // Publish via HTTP POST
243249 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' });
244254 }
245255
246256 return (
You can’t perform that action at this time.
0 commit comments