Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ export default function App() {

async function publishEvent() {
await events.post('default/channel', { some: 'data' });

// Alternative way to publish events through the channel
const channel = await events.connect('default/channel');
await channel.publish({ some: 'data' });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await events.post('default/channel', { some: 'data' });
// Alternative way to publish events through the channel
const channel = await events.connect('default/channel');
await channel.publish({ some: 'data' });
// publish via HTTP POST
await events.post('default/channel', { some: 'data' });
// Alternatively, publish events through the WebSocket channel
const channel = await events.connect('default/channel');
await channel.publish({ some: 'data' });

looking at the content changes again I think it would be helpful to describe the differences between these two options. Although the API is clear in its intentions with .post(), adding a note will provide additional clarity especially when evaluating the alternative

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense, I have added a note for each option to clarify for the users.

}

return (
Expand Down Expand Up @@ -241,6 +245,10 @@ export default function App() {

async function publishEvent() {
await events.post('default/channel', { some: 'data' });

// Alternative way to publish events through the channel
const channel = await events.connect('default/channel');
await channel.publish({ some: 'data' });
}

return (
Expand Down