ipfs-shipyard / ipfs-pubsub-room

IPFS Pubsub room
MIT License
288 stars 41 forks source link

TypeError: Class constructor PubSubRoom cannot be invoked without 'new' #79

Open brailateo opened 4 years ago

brailateo commented 4 years ago

The docs are outdated? The example in home page says

const room = Room(ipfs, 'room-test1')

but running node test-pubsub-1.js got

(node:26783) UnhandledPromiseRejectionWarning: TypeError: Class constructor PubSubRoom cannot be invoked without 'new'

after adding new Room got another error:

(node:26834) UnhandledPromiseRejectionWarning: TypeError: this._libp2p.pubsub.getSubscribers is not a function at PubSubRoom._pollPeers (/old/home/teo/node_modules/ipfs-pubsub-room/src/index.js:106:49)

So , is ipfs-pubsub-room working or just the docs are outdated? Teo

achingbrain commented 4 years ago

The docs are outdated and the internals may need to be refactored to work with the latest libp2p.

Would you like to submit a PR?

dai-shi commented 4 years ago

In my project, I use ipfs v0.48.0, and with my modification #80 it works. Not quite sure about the errors reported in this issue, though.