Git Product home page Git Product logo

ipfs-pubsub-room's Introduction

ipfs-pubsub-room

made by Protocol Labs Freenode Build Status

Creates a room based on a LibP2P pub-sub channel. Emits membership events, listens for messages, broadcast and direct messeges to peers.

(Demo video)

Install

$ npm install ipfs-pubsub-room

Use

Creating a pubsub room from a LibP2P node

const Room = require('ipfs-pubsub-room')
const Libp2p = require('libp2p')

const libp2p = new Libp2p({ ... })
await libp2p.start()

// libp2p node is ready, so we can start using ipfs-pubsub-room
const room = Room(libp2p, 'room-name')

Creating a pubsub room from an IPFS node

const Room = require('ipfs-pubsub-room')
const IPFS = require('ipfs')

const ipfs = await IPFS.create({ ... })
const room = Room(ipfs, 'room-name')

Once we have a room we can listen for messages

room.on('peer joined', (peer) => {
  console.log('Peer joined the room', peer)
})

room.on('peer left', (peer) => {
  console.log('Peer left...', peer)
})

// now started to listen to room
room.on('subscribed', () => {
  console.log('Now connected!')
})

API

Room (libp2p:LibP2P, roomName:string, options:object)

  • libp2p: LibP2P node. Must have pubsub activated
  • roomName: string, global identifier for the room
  • options: object:
    • pollInterval: interval for polling the pubsub peers, in ms. Defaults to 1000.
const room = Room(libp2p, 'some-room-name')

room.broadcast(message)

Broacasts message (string or Uint8Array).

room.sendTo(cid, message)

Sends message (string or Uint8Array) to peer.

async room.leave()

Leaves room, stopping everything.

room.getPeers()

Returns an array of peer identifiers (strings).

room.hasPeer(cid)

Returns a boolean indicating if the given peer is present in the room.

room.on('message', (message) => {})

Listens for messages. A message is an object containing the following properties:

  • from (string): peer id
  • data (Uint8Array): message content

room.on('peer joined', (cid) => {})

Once a peer has joined the room.

room.on('peer left', (cid) => {})

Once a peer has left the room.

room.on('subscribed',() => {})

Once your program has subscribed the topic and announced through IPFS pubsub.

License

ISC

ipfs-pubsub-room's People

Contributors

achingbrain avatar aquigorka avatar daviddias avatar eolszewski avatar haadcode avatar hacdias avatar josselinchevalay avatar pgte avatar victorb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ipfs-pubsub-room's Issues

peers dissappear while still online

  • Version: commit: "", repo: 7, version: "0.32.3"
  • Platform: Chrome, Mac OS X Mojave (but bug happens on other platforms: Windows, Yandex Browser)
  • Subsystem: pubsub

Type: Bug

Severity: High

Description:

Sometimes, but very rarely, module loses connected peers and (presumably) calls them offline, while retaining connection for them (see screenshot).

The thing is our app highly relies on online/offline peer status, so we need to know for sure when peer went offline. To track that, we rely on pubsub's 'user offline' events.

Unfortunately, it seems sometimes message comes when user didn't really went offline. And then we can't know he is online, because pubsub does not send event when user's already online.

Steps to reproduce the error:

I can't reproduce it for now, but it happens once in a while.

Our code:
(https://github.com/swaponline/swap.core/blob/master/src/swap.room/SwapRoom.js#L80)

this.connection = ipfsRoom(...)

this.connection.on('peer joined', this._handleUserOnline)
this.connection.on('peer left', this._handleUserOffline)

Screenshots:

image

how to use localhost libp2p-websocket?

I run my own libp2p-websocket-star signalling-server with this address: /ip6/127.0.0.1/tcp/9090/ws/p2p-websocket-star/

how to use this address as a swarm ?

'suspicious' npm release

I noticed that there is a v1.2.1 release on npm... but it's not published as release and tagged here. Any insights in what has changed?

My room did nothing when a peer has joined?

I was following the demo video on youtube: https://www.youtube.com/watch?v=Nv_Teb--1zg
But when I add a room in my code and test it. The console gives no reactions when another peer joined the room.
Here's my code:

const IPFS = require('ipfs')
const Room = require('ipfs-pubsub-room')

const ipfs = new IPFS({
	repo: repo(),
	EXPERIMENTAL: {
		pubsub : true
	}
})

ipfs.once('ready', () => ipfs.id((err,info) => {
	if (err) {throw err}
	console.log('IPFS is ready with the address ' + info.id)
}))

const room = Room(ipfs, 'ipfs-pubsub-room-demo')
console.log(room.id)
room.on('peer joined', (peer) => console.log('some peer '+ peer +' has joined'))
room.on('peer left', (peer) => console.log('some peer '+ peer +' has left'))

function repo () {
	return 'ipfs/pubsub-demo/' + Math.random()
}

And when I test the code on Chrome, the console only gives the ID of the node, but no messages like 'some peer XXXX has joined.'

"Some tests are failing"

When trying to run the tests, they error with the following error message (see below). I took a fresh clone and run npm i && npm test. Looks like a mocha/aegir error to me.

Any suggestions how to fix the tests?

haad:~/code/ipfs-pubsub-room$ npm test

> [email protected] test /Users/haad/code/ipfs-pubsub-room
> npm run lint && npm run test:browser


> [email protected] lint /Users/haad/code/ipfs-pubsub-room
> aegir lint



> [email protected] test:browser /Users/haad/code/ipfs-pubsub-room
> aegir test --target browser --dom

Test Browser


Chrome 62.0.3202 (Mac OS X 10.11.6) LOG: 'Swarm listening on', '/dns4/star-signal.cloud.ipfs.team/wss/p2p-webrtc-star/ipfs/QmZxPaE9QCnXYAxQ3vSrVZnkyQW7tef9GVVyCeTe11Bowo'
Chrome 62.0.3202 (Mac OS X 10.11.6) LOG: 'Swarm listening on', '/dns4/star-signal.cloud.ipfs.team/wss/p2p-webrtc-star/ipfs/QmTEJ7KnSKWuihB6B9sBABDwywKHkv4qvmTP3uqLQFVo8M'
  sync
    1) can create a room, and they find each other
    2) has peer
    3) can broadcast
    4) can send private message
    5) can be stopped


  0 passing (27s)
  5 failing

30 10 2017 14:46:08.054:ERROR [karma]: TypeError: test.titlePath is not a function
    at /Users/haad/code/ipfs-pubsub-room/node_modules/mocha/lib/reporters/base.js:227:10
    at Array.forEach (<anonymous>)
    at Function.exports.list (/Users/haad/code/ipfs-pubsub-room/node_modules/mocha/lib/reporters/base.js:167:12)
    at Spec.Base.epilogue (/Users/haad/code/ipfs-pubsub-room/node_modules/mocha/lib/reporters/base.js:344:10)
    at emitNone (events.js:110:20)
    at EventEmitter.emit (events.js:207:7)
    at Reporter.onRunComplete (/Users/haad/code/ipfs-pubsub-room/node_modules/karma-mocha-own-reporter/index.js:174:16)
    at Server.<anonymous> (/Users/haad/code/ipfs-pubsub-room/node_modules/karma/lib/events.js:13:22)
    at emitTwo (events.js:130:20)
    at Server.emit (events.js:213:7)
    at emitRunCompleteIfAllBrowsersDone (/Users/haad/code/ipfs-pubsub-room/node_modules/karma/lib/server.js:295:12)
    at Server.<anonymous> (/Users/haad/code/ipfs-pubsub-room/node_modules/karma/lib/server.js:326:7)
    at emitOne (events.js:115:13)
    at Server.emit (events.js:210:7)
    at Server.<anonymous> (/Users/haad/code/ipfs-pubsub-room/node_modules/karma/lib/server.js:309:12)
    at emitTwo (events.js:130:20)
Some tests are failing
Error: Some tests are failing
    at Server (/Users/haad/code/ipfs-pubsub-room/node_modules/aegir/src/test/browser.js:12:16)
    at removeAllListeners (/Users/haad/code/ipfs-pubsub-room/node_modules/karma/lib/server.js:380:7)
    at Server.<anonymous> (/Users/haad/code/ipfs-pubsub-room/node_modules/karma/lib/server.js:391:9)
    at Object.onceWrapper (events.js:314:30)
    at emitNone (events.js:110:20)
    at Server.emit (events.js:207:7)
    at emitCloseNT (net.js:1646:8)
    at _combinedTickCallback (internal/process/next_tick.js:135:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test:browser: `aegir test --target browser --dom`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test:browser script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/haad/.npm/_logs/2017-10-30T13_46_08_757Z-debug.log
npm ERR! Test failed.  See above for more details.

Tests should use a "on the fly Signalling Server" and not the hosted one

Saw that running tests is running against the hosted node.

Chrome 60.0.3112 (Mac OS X 10.12.6) LOG: 'Swarm listening on', '/libp2p-webrtc-star/dns4/star-signal.cloud.ipfs.team/wss/ipfs/QmZTkjJoH9Q2Qm7en8V5LtsWjzEJuGuKsLb2xQXE4Pb921'
Chrome 60.0.3112 (Mac OS X 10.12.6) LOG: 'Swarm listening on', '/libp2p-webrtc-star/dns4/star-signal.cloud.ipfs.team/wss/ipfs/QmTzYhkM3XpRZAwRipJjcFZyAiGUjAwhHQkCXFyDUeBtbU'

This opens the possibility to have failures by external forces that are not controlled by tests.

'message' event should contain 'topicCIDs' array when emitted from _handleDirectConnection()

Hey, I started looking into if we can use this module in orbit-db to achieve what @diasdavid suggested some time ago, to handle the "send first message automatically upon connecting to a peer" (it seems we can! ๐ŸŽ‰ โค๏ธ)

In orbit-db's pubsub wrapper, we're relying on the topicCIDs array that is part of the message that is received from pubsub. And it's present in the messages ipfs-pubsub-room emits when messages are received as a "broadcast" but not when they're sent directly to a peer with sendTo().

I took a look at the code and it looks to me that this is the place where we're missing the the topicCIDs array: https://github.com/ipfs-shipyard/ipfs-pubsub-room/blob/master/src/index.js#L138. Ie. to fix it, we should add topicCIDs: [ this._topic ] on line 141:

pull.map((message) => {
  this.emit('message', {
    from: peerId,
    data: message,
    topicCIDs: [ this._topic ]
  })
  return message
}),

I started to write a PR, but unfortunately the tests are not running. I'd be happy to PR the fix.

Would you agree this is the right fix? Did I miss anything?

@pgte I love how this module exposes the 'peer joined' and 'peer left' events as well as gives us direct access to send a message to a specific peer. Thank you for writing it! โค๏ธ

broadcast

Hello,
Nice work! While trying it out I only seem to be able to see my own broadcast messages. If another peer broadcasts only he sees it. Am I doing something wrong??

Here is my code:

    const room = Room(ipfs, 'presence')

			room.on('message',function(msg){
				console.log(msg.data.toString());
			});
			room.broadcast('hmmph!');
			//room.sendTo('QmcAmvDo7wwSxsP3DJYZuJpZqps7nUUcHUvn8r5SMUvBgf', "{}");

			room.on('peer joined',function(peer){
				console.log(peer + ' joined');
			});
			room.on('peer left',function(peer){
				console.log(peer + ' left');
			});

Wrong topicIDs when sending a direct message

As I started debugging what's causing orbitdb/orbitdb#258, I found out that when sending direct messages, we sometimes have the wrong topicID in our topicIDs array.

If I'm not mistaken, the peer connection is shared between rooms (topics), so when we send a direct message to the peer, it might end up getting handled in a different room instance. This is, I believe, because of the _handleDirectConnection() pulls directly from the (shared-between-rooms) connection and as such, the handler being used can be the one created in room A while the message was sent via room B. So essentially, when we set topicCIDs: [ this._topic ], this is not actually tied to the topic.

I'm not sure how we should fix this. It feels to me as it is today, it's breaking the room abstraction (a direct message sent from one room can "appear" in another), but then again, sending a direct message to a peer on the abstraction level doesn't necessarily need to be tied to a particular room. One solution would be to change the sendTo() method so that it creates a proper PubSub message like we do on the receiving end, that way we can tie the room (topic) ID to the direct message.

The question is, do we want that? Do we want the direct messages be per-room, or do we want them to be per-user/connection?

Any thoughts @pgte?

HTTPS clients can't discover each other, but can discover and be discovered by HTTP-only clients

This demo code doesn't seem to work once pushed behind an HTTPS endpoint. Specifically, HTTPS clients are communicating with the signaling server, but they're never made aware of one another. HTTP-only clients don't have this issue, and the interesting part is that an HTTP-only client can also discover and be discovered by HTTPS clients. There's just the disconnect between HTTPS clients and other HTTPS clients.

I thought maybe it was the signaling server, so I deployed my own libp2p-websocket-star rendezvous server to no avail. Am I missing something?

How do you associate a node id with a user identity

I have user stored in database. When this user logs in and starts 1-on-1 chat with another user, we create a room for them. When the user joins, we get a peer joined event, but this peer CID is not associated with the user at all. What is the best way to associate node id with a user identity?

Also there seems to a significant delay when peer joined event is fired

Thanks in advance!

Already Piped Error

The error I get has been around for quite long if you search for it:

https://github.com/libp2p/js-libp2p-switch/issues/235

I get it with js-ipfs version 0.31.4, 0.31.3, and 0.30.0, but I think every version has it. This is what I get:

js-ipfs/node_modules/pull-pair/index.js:11
      throw new Error('already piped')

the node crashes with varying delays, can be 15 minutes or last for much longer, it's preventing me to use IPFS.

Program crash

I used 2 peers connected to each other and sending direct messages when joining room. If I kill one peer the other one crashes.

Thanks!

Direct p2p messages.

I see this app can send messages directly to a chosen peer. That's pretty cool, as I was looking for a way to do this.

How efficient is this method compared to sending a UDP message to that peer? Does this method broadcast anything or actually sends the message directly to the peer? If we group all the IPFS nodes into pairs and let one node send a p2p message to the other node, will it cause any troubles?

Promise rejection warning

UnhandledPromiseRejectionWarning: TypeError: this._libp2p.pubsub.getSubscribers is not a function at PubSubRoom._pollPeers (ipfs-pubsub-room\src\index.js:106:49) at listOnTimeout (internal/timers.js:531:17) at processTimers (internal/timers.js:475:7) (node:5828) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

I got this error when I made a Room with IPFS node. How to solve this?

Enabling Pubsub in the browser

I was trying to use ipfs-pubsub-room in the browser (using a browserified version of the package, not my entire script), and i keep getting the error: Uncaught Error: This IPFS node does not have pubsub.. I know the configuration used to be EXPERIMENTAL: {pubsub: true}, but it seems like it changed and i don't know how to make it work in the browser anymore. What is the correct way to do it?

Cannot start module

Trying to make a very simple application with ipfs-pubsub-room but I'm unable to start using it. I'm getting different errors in different browsers.

Chrome:

index.js:42891 Swarm listening on /dns4/star-signal.cloud.ipfs.team/wss/p2p-webrtc-star/ipfs/QmbNq2y2LJ1mRMaCQyh3RaWyNG7UMNHkA8ryxVw1B1c3Fa
index.js:43352 Uncaught TypeError: Cannot read property 'listenerCount' of undefined
    at subscribe (index.js:43352)
    at Object.subscribe (index.js:43294)
    at PubSubRoom._start (index.js:38491)
    at new PubSubRoom (index.js:38448)
    at module.exports (index.js:38425)
    at IPFS.ipfs.on (index.js:9)
    at IPFS.EventEmitter.emit (index.js:32372)
    at done (index.js:41957)
    at index.js:3473
    at index.js:3414
subscribe @ index.js:43352
subscribe @ index.js:43294
_start @ index.js:38491
PubSubRoom @ index.js:38448
module.exports @ index.js:38425
ipfs.on @ index.js:9
EventEmitter.emit @ index.js:32372
done @ index.js:41957
(anonymous) @ index.js:3473
(anonymous) @ index.js:3414
replenish @ index.js:3171
iterateeCallback @ index.js:3161
(anonymous) @ index.js:3430
(anonymous) @ index.js:3470
done @ index.js:43402
series @ index.js:43438
(anonymous) @ index.js:3473
(anonymous) @ index.js:3414
replenish @ index.js:3171
iterateeCallback @ index.js:3161
(anonymous) @ index.js:3430
(anonymous) @ index.js:3470
self._libp2pNode.start @ index.js:42894
(anonymous) @ index.js:3473
(anonymous) @ index.js:3414
replenish @ index.js:3171
iterateeCallback @ index.js:3161
(anonymous) @ index.js:3430
(anonymous) @ index.js:3470
series @ index.js:57097
(anonymous) @ index.js:3465
replenish @ index.js:3176
iterateeCallback @ index.js:3161
(anonymous) @ index.js:3430
(anonymous) @ index.js:3470
series @ index.js:57093
(anonymous) @ index.js:3465
replenish @ index.js:3176
iterateeCallback @ index.js:3161
(anonymous) @ index.js:3430
(anonymous) @ index.js:3470
(anonymous) @ index.js:3414
iteratorCallback @ index.js:2712
(anonymous) @ index.js:3430
setImmediate @ index.js:53763
(anonymous) @ index.js:3722
Item.run @ index.js:89584
drainQueue @ index.js:89554
setTimeout (async)
runTimeout @ index.js:89472
process.nextTick @ index.js:89574
(anonymous) @ index.js:3721
listener.getAddrs @ index.js:55599
listener.listen @ index.js:55346
f @ index.js:88443
listener.io.once @ index.js:55550
on @ index.js:19231
Emitter.emit @ index.js:19299
Socket.emit @ index.js:105196
Socket.onconnect @ index.js:105387
Socket.onpacket @ index.js:105284
(anonymous) @ index.js:19162
Emitter.emit @ index.js:19299
Manager.ondecoded @ index.js:104804
(anonymous) @ index.js:19162
Emitter.emit @ index.js:19299
Decoder.add @ index.js:105945
Manager.ondata @ index.js:104794
(anonymous) @ index.js:19162
Emitter.emit @ index.js:19299
Socket.onPacket @ index.js:26727
(anonymous) @ index.js:26544
Emitter.emit @ index.js:19299
Transport.onPacket @ index.js:27162
Transport.onData @ index.js:27154
ws.onmessage @ index.js:28280
index.js:43337 Uncaught TypeError: Cannot read property 'peers' of undefined
    at Function.peers.promisify (index.js:43337)
    at Object.peers (index.js:89750)
    at PubSubRoom._pollPeers (index.js:38507)

Cannot read property 'peers' of undefined then continuous to happen once a second.

In Firefox I see the following:

Swarm listening on /dns4/star-signal.cloud.ipfs.team/wss/p2p-webrtc-star/ipfs/QmQDi3fAuQ7cvsS4H511C6UZh5rFruUxNeiM2cFMPn9yWz
index.js:42891:13
TypeError: ps is undefined
[Learn More]
index.js:43352:1
TypeError: self._pubsub is undefined
[Learn More]
index.js:43337:13
TypeError: self._pubsub is undefined
[Learn More]

And TypeError: self._pubsub is undefined [Learn More] happens once a second.

This is my full code:

const Room = require('ipfs-pubsub-room')
const IPFS = require('ipfs')
const ipfs = new IPFS({
  repo: 'repo-'+String(Math.random())
})

ipfs.on('ready', () => {
  const room = Room(ipfs, 'room-name')

  room.on('peer joined', () => {
    console.log('Peer joined the room')
  })

  room.on('peer left', () => {
    console.log('Peer left...')
  })

  room.on('subscribed', () => {
    console.log('Now connected!')
  })
})

Using [email protected] and [email protected]

room.broadcast only sends messages to itself not other peers.

Problem:

I was trying to follow along this tutorial on ipfs-pubsub-room.

The problem is when I do room.broadcast('some message').

Other peers do not get the message but the sender gets its own message.

Here's the code I wrote:

const IPFS = require('ipfs')
const Room = require('ipfs-pubsub-room')

const ipfsRepo = require('./utils/ipfs-repo')

const ipfs = new IPFS({
  repo: ipfsRepo(),
  EXPERIMENTAL: {
    pubsub: true
  },
  config: {
    Addresses: {
      Swarm: [
        '/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star'
      ]
    }
  }
})

ipfs.once('ready', () => {
  ipfs.id((err, info) => {
    if (err) throw err
    console.log('IPFS node ready with address,', info.id)
  })

  const room = Room(ipfs, 'cPsnqzpAslkNCgGw6Tid')

  room.on('peer joined', (peer) => {
    console.log('peer ', peer, 'joined')
  })

  room.on('peer left', (peer) => {
    console.log('peer', peer, 'left')
  })

  room.on('message', (message) => {
    console.log('message from', message.from, 'contents:', message.data.toString())
  })

  setTimeout(() => room.broadcast('hey everyone!'), 2000)
})

Dependencies List:

"dependencies": {
    "ipfs": "^0.34.4",
    "ipfs-pubsub-room": "^1.4.1"
  }

preparations for js-ipfs 0.36

๐Ÿ‘‹ I upgraded ipfs to 0.36.0-rc.0 and all the tests failed ๐Ÿ˜ข

BUT! Then I renamed all occurances of _libp2pNode to libp2p and they passed! Hooray!

Please check out the release issue for more info.

Non-Local Usage

Hello,

Does pubsub-room or the demo in the video work with two different computers on different private networks or does it just work on a private network or a singular computer?

Thank you

Using PubSub for high noise networks

https://github.com/mikezucc/metaverse-ipfs

I am trying to create a multiplayer js extension to A-Frame.js. I have achieved working version with a central server running socket.io to distribute client metadata. I am cleaning up the repo for that, it will be up soon (lots of profanity). However, centralized server isn't exciting and it is fragile. I want to use a p2p mesh solution so that only a signaling server need be maintained so I took a look at the IPFS PubSub demo ( and I don't have to pay for a big grumpy server running socket.io ). I am fairly fresh to the available technologies for this.

My requirements:

  • Room/Channel based subscription
  • Broadcast JSON every 100ms
  • Abstracted fallback protocols

Running multiple clients on the same machine I found that only 5% the exchange of data between clients seemed to work and even then it was extremely high CPU load. I am trying to send metadata updates (if necessary) every 100ms. This interval should be fine for clients locally I assume.

I think the problem is running clients on the same machine does not play well with PubSub, libp2p and creating a pipe within same IP?

The project should run out of the box. A-Frame itself is super inefficient in any case, but it is fine to run at roughly 60fps on my macbook air 2013

Get current peerID

can i get current peer id ? after

room.on('subscribed', () => {
    console.log('Now connected!')
})

how am i sure my node is really connected

Hi i attempt to use that but i have weird behavior.

let room = Room(node, "test")
console.log(room.getPeers()) // [] ever if i have already run a another node

but i create a little server to this code return list of peerId

i don't understand

Regards

Failed to minify

I am trying to make a production build including ipfs-pubsub-room via create-react-app:

$ npm run build
[...]
Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file:

 	../y-ipfs-connector/node_modules/ipfs-pubsub-room/src/encoding.js:5

Read more here: http://bit.ly/2tRViJ9

Following the troubleshooting bitly link:

Issue: ES6 is used, minifyer expects ES5 only
"Solution": "[...] ask that the package be published pre-compiled"

Would it be possible to include a precompiled ES5 version of this lib?

Thank you!

Error on npm install ipfs-pubsub-room

I'm getting the following error when I try to install:

$ npm install -S ipfs-pubsub-room
npm ERR! Error while executing:
npm ERR! /usr/local/bin/git ls-remote -h -t ssh://[email protected]/haadcode/ipfs-pubsub-room.git
npm ERR! 
npm ERR! [email protected]: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR! 
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR! 
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/lauradewitt/.npm/_logs/2018-08-03T21_07_40_526Z-debug.log

anyone else encounter this? I also see the same with npm i git+https://[email protected]/ipfs-shipyard/ipfs-pubsub-room.git

Uncaught Error: no protocol with name: p2p-webrtc-star

I get this error when running ipfs pubsub room demo. What should I do?

Uncaught Error: no protocol with name: p2p-webrtc-star
    at Protocols (protocols-table.js:17)
    at stringToStringTuples (codec.js:45)
    at stringToBuffer (codec.js:170)
    at Object.fromString (codec.js:178)
    at new Multiaddr (index.js:39)
    at Multiaddr (index.js:27)
    at WebRTCStar._peerDiscovered (index.js:223)
    at Socket.Emitter.emit (index.js:133)
    at Socket.onevent (socket.js:270)
    at Socket.onpacket (socket.js:228)

Make ipfs-pubsub-room work with js-ipfs-api

Starting with an IRC conversation:

02:28 <@haad> pedrot, daviddias: I'm facing a challenge bringing orbit-db usable with ipfs-api again: ipfs-pubsub-room. I was looking into it yesterday and
              realized (as we're using pubsub-room in orbitdb) that it ain't gonna work as it today with ipfs-api
02:29 <@haad> ...as we're using libp2p directly in pubsub-room
02:29 <@haad> so I'm thinking how to solve this and would appreciate your input
02:30 <@haad> been thinking 1) expose libp2p apis in http-api (prolly not a good idea and definitely a lot of work) 2) use primitives already available in
              http-api
02:31 <@haad> 2) makes a lot more sense to me in order to keep compatibility between js-ipfs ans js-ipfs-api
02:32 <@haad> so I ws thinking, what if we separated the direct connections from room and used PubSub to provide the same mechanism but with a "direct" topic
              between two peers
02:32 <@daviddias> haad I believe pedrot designed it that way so that there was actually a room and not a crowd
02:32 <@daviddias> PubSub is always floodsub
02:33 <@daviddias> but yeah, doing it right (1)) would be awesome but requires more than an evening of hacking
02:33 <@haad> something like (topic name): "/pubsub-direct/QmPeer1/QmPeer2"
02:34 <@haad> that ^ wouldn't be "private" by default in any way though, so I was thinking if we could add something to authenticate on floodsub level (perhaps
              just a "authenticate()" function passed to the subscription or smth, nothing fancy with keys)

Problem: ipfs-pubsub-room doesn't work with ipfs-api

Causes: We're using libp2p primitives in the direct connections, which are not available through the http-api on go-ipfs (and thus not available in js-ipfs-api)

Solution: ???

My strongest proposal atm is the one proposed ^ with a "direct" pubsub channel between two peers. I like it because it would decouple the direct-connection abstraction from room and it's something we can do using the primitives available in both implementations (regular pubsub primitives). The down side is that anyone can publish/subscribe to it without changes to floodsub, so it's definitely not private channel in any way. To address that, I was thinking we could add an argument to pubsub function that takes in a authenticate(peerId) function that the user provides when subscribing. The function would return true|false according to its own authentication rules, but in this case it would look something like: const authenticate = (peerId) => peerId && (peerId === this._receiverId || peerId === this._senderId) where _receiverId and _senderID are the IPFS IDs in the topic name ("/pubsub-direct/QmPeer1/QmPeer2").

I would love to hear other possible solutions as well as comments on the proposal ^.

Bug: handler attempts to unsubscribe to stopped node

  • Version: version: '0.28.1', repo: 6, commit: ''
  • Platform: Ubuntu
  • Subsystem: libp2p

Type: Bug

Severity: Medium

Description: When running tests with Jest, one test produces this error before going on to complete successfully.

As discussed here, when calling ipfs.stop() as part of a test, the error libp2p node is not started yet is thrown.

@alanshaw reports this appears to be due to a handler attempting to unsubscribe to the already-stopped node.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.