Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

docs: update PUBSUB.md #3880

Merged
merged 2 commits into from
Sep 21, 2021
Merged
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions docs/core-api/PUBSUB.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ An optional object which may have the following keys:

```JavaScript
const topic = 'fruit-of-the-day'
const receiveMsg = (msg) => console.log(msg.data.toString())
const receiveMsg = (msg) => console.log(new TextDecoder("utf-8").decode(msg.data))
achingbrain marked this conversation as resolved.
Show resolved Hide resolved

await ipfs.pubsub.subscribe(topic, receiveMsg)
console.log(`subscribed to ${topic}`)
Expand Down Expand Up @@ -203,4 +203,4 @@ console.log(peerIds)
A great source of [examples][] can be found in the tests for this API.

[examples]: https://github.com/ipfs/js-ipfs/blob/master/packages/interface-ipfs-core/src/pubsub
[AbortSignal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
[AbortSignal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal