Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

docs: browser pubsub example #1060

Closed
wants to merge 11 commits into from
Closed

Conversation

alanshaw
Copy link
Contributor

@alanshaw alanshaw commented Jul 26, 2019

An example demonstrating pubsub in the browser.

Screenshot 2019-07-26 at 10 11 18

TODO:

  • Add README
  • Make runnable via npm start
  • Update ipfs-http-client README to remove pubsub caveat

Depends on:

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
if (!window.ipfs) throw new Error('Connect to a node first')

log(`Sending message to ${topic}...`)
await window.ipfs.pubsub.publish(topic, IpfsHttpClient.Buffer.from(msg))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now accepts strings.

Suggested change
await window.ipfs.pubsub.publish(topic, IpfsHttpClient.Buffer.from(msg))
await window.ipfs.pubsub.publish(topic, msg)

@alanshaw
Copy link
Contributor Author

Superseded by #1086

@alanshaw alanshaw closed this Aug 28, 2019
@alanshaw alanshaw deleted the docs-browser-pubsub-example branch August 28, 2019 17:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant