Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
verschmelzen
@verschmelzen:matrix.org
[m]
maybe there is a part of documentation that I missed about it
verschmelzen
@verschmelzen:matrix.org
[m]
I found the issue right after I asked my question here)
is was not passing msg['#'], I called open(ok: {rtc: {id: rtc.id}}}), but the right solution is open({'#': ''+msg['#'], ok: {rtc: {id: rtc.id}}})
tf2_pyro
@tf2_pyro:matrix.thisisjoes.site
[m]
When you get a key:val, does gun get the entire node under the hood, or are you really only downloading that value?
rococtz
@rococtz:matrix.org
[m]
tf2_pyro: it depends. you can get either one level of depth or full depth, but that's not up to get. That's up to what you use AFTER get: on, once, open, load
tf2_pyro
@tf2_pyro:matrix.thisisjoes.site
[m]

I think you misunderstand. I'm not getting an object, I'm getting a key:val of an object.
Heres an example of what I mean:

{
  _:  {
    #: "demo/space",
    >:  { ... }
  },
  valueIDontNeed: "fuaigfiydt67f9tq",
  valueIWant: "xxxxxxx"
}

if I run await gun.get("demo/space").get("valueIWant") is gun downloading the whole node, including value I dont need? or is it only getting the value I asked for?

2 replies
Mark mentioned in a livestream that gun does the former, but he also said that they were working on changing that, and said livestream is 6 years old, so theres a good chance he has. But idk
tf2_pyro
@tf2_pyro:matrix.thisisjoes.site
[m]

:point_up: Edit: I think you misunderstand. I'm not getting an object, I'm getting a key:val of an object.
Heres an example of what I mean:

{
  _: {
    #: "demo/space",
    >: { ... }
  },
  importantValue: "xxxxxxx",
  irrelevantValue: "fuaigfiydt67f9tq"
}

if I run await gun.get("demo/space").get("importantValue") is gun downloading the whole node, including the irrelevant value? or is it only getting the value I asked for?

Daniel Raeder
@draeder

Could someone please help me figure out how this line works and why it might not be received by remote peer.

root.on('out', {'@': msg['#'], '#': root.ask(open), ok: {rtc: {offer: offer, id: opt.pid}}});

I am trying to add ability to to add video and audio streams to existing peer connection in lib/webrtc.js and that requires ability to renegotiate SDP more than one time.

After many attempts the way I am currently trying to do this is to run pc creation part only if there is no existing peer connection, and by calling open() if there is onnegotiationneeded event fired.

@verschmelzen:matrix.org
Thank you for working on this! If you get it sorted out, please submit a PR for lib/webrtc.js so we can have an example of video + audio! That would be amazing.

1 reply
Drew Simmons
@timsim00
Can someone point me to the best working open-source example of gun ACL in 2022?
mikelun.eth
@mikelun
Hi, what is the best use case to update player positions? If I use ".set" - it stores all values when other peers connect, and ".put" doesn't change positions
4 replies
leoncstew
@leoncstew
Greetings!
probably a simple question.. can some point me to an example of how to use Rad to build create a storage adapter?
Daniel Raeder
@draeder

Can someone point me to the best working open-source example of gun ACL in 2022?

Do you mean Access Control List? If so, you would use SEA.encrypt()and SEA.decrypt() along with SEA.certify() to create access/read/write policies. https://gun.eco/docs/SEA#certify

probably a simple question.. can some point me to an example of how to use Rad to build create a storage adapter?

All storage adapter examples are here: https://gun.eco/docs/Storage

acblackburn
@acblackburn

Good Afternoon, I'm currently trying to set up gun as a p2p backend for my decentralised application. I'm using gun in react and and currently testing my understanding my adding and removing items from a set according to a form input. I retrieve the 'items' set from gun using:

const gunItems = gun.get('items');

Then add a new item to the set by doing:

const newItem = gun.get(keccak256(formData).toString('hex')).put({data: formData})
gunItems.set(newItem);

In this case, I'm creating objects in gun where the key is the hash of the data in the form of hash(data) : {data: formData}.

I'm "deleting" data using:

gunItems.get(keccak256(formData).toString('hex')).put(null);

After adding "a", "b", then deleting "a" and looking at my local storage, I can see that within the items set, hash(a) : null. However, the object hash(a) : {data: "a"} still exists outside of the set. Shouldn't all values associated with hash(a) be null?

acblackburn
@acblackburn
For Context, here's my local storage:
image.png
leoncstew
@leoncstew
how to pass options to Rad while using Rad with Gun?
Alex Zanfir
@AlexZan
Can images/video/files be propagated through the gun network or do i need to use something like ipfs?
rococtz
@rococtz:matrix.org
[m]
@AlexZan: If you want to store files in Gun, you encode them as base64 text and save them, but that's not really the best way to do it, I wouldn't use Gun for that
verschmelzen
@verschmelzen:matrix.org
[m]
gun.eco seems down for me, no content is loaded on page
2 replies
is there a part of the doc that explains how this works root.on('out', {'@': msg['#'], '#': root.ask(open), ok: {rtc: {offer: offer, id: opt.pid}}});?
Carlos Vega
@alterx
Yeah @AlexZan, you can definitely chunk the image, encode it and save it but as the images get bigger it gets more difficult. And also take in account that base64 encoding means your files get 37% larger (https://www.wikiwand.com/en/Base64) due to the fact that it uses sequences of 6 bits but BLOBs use 8 bit sequences
Depending on your use case i'd look into other technologies that are more well suited for this. IPFS is a great example
‹› ‹(•_•)› ‹›
@computervillain_twitter

Can images/video/files be propagated through the gun network or do i need to use something like ipfs?

IPFS public gateways appear to be.. well, no longer public. I was loading lots of content for free. Anyone else seeing that for their projects?

Chandan Das
@champ5898
Is there a way to remove these from console:
WebSocket connection to 'ws://localhost:8765/gun' failed:
WebSocket connection to 'wss://gun-armitro.herokuapp.com/' failed:
WebSocket connection to 'wss://gun-manhattan.herokuapp.com/gun' failed:
WebSocket connection to 'wss://gun-eu.herokuapp.com/gun' failed:
Daniel Raeder
@draeder

@champ5898 We've talked about moving console.log in gun over to an error event handler, but it's lower on the priority list than upgrading gun's DHT. You could potentially turn off all console logging:

let cl = console.log
console.log = {}

// Turn back on:
console.log = cl

But please keep the welcome message unless you are paying for professional support

1 reply
ADAM BLVCK
@adam_blvck:matrix.org
[m]
I agree with @alterx … something which exceeds heap space (2Mbyte files in browser afaik) ought to be uploaded to a CDN, or S3, or even IPFS. Once you’ve encrypted the image (by chunking the base64 files), it doesn’t actually matter where the file is stored, because no one can actually open it
dev1n
@dev1n:matrix.org
[m]
How about something like WebTorrent?
To keep it P2P
1 reply
ADAM BLVCK
@adam_blvck:matrix.org
[m]
@alterx: I have a question for you in React Native. How would you approach resetting the gun instance (ie. creating a new one), if the one which is worked upon is setup in a context provider
Make sure to add a signature of sorts to your encrypted files
I usually just sign the first base64 chunk with the public key of the user sending the file
gunchatbridge
@gunchatbridge
[D]Server Destroyer:
[D]Dyno: Welcome <@181511138519810048>!!! GUN (https://github.com/amark/gun) is a P2P protocol for syncing data used by 8M+ people monthly across Internet Archive, HackerNoon, DTube (decentralized youtube), Notabug (p2p reddit), & more. Please try the 5min tutorial (https://gun.eco/docs/Todo-Dapp) to get started!
dev1n
@dev1n:matrix.org
[m]

I'm having a very mysterious bug, where I'm trying to pass a IGunUserInstance around from a factory function to a client function, but the object seems to be mutated when it exits my factory function.
If I return user.get.bind(user) directly, then there is no problem. But if I return user (const user = gun.user()), then the object outside the factory function is different and "loses" the .get method.

Does this talk to anyone?

The factory function code is:
function userFactory() {
 const user = gun.user()
  return new Promise(resolve => {
    gun.on('auth', () =>{
      console.log(user.get); // fine
      resolve(user);
    });
  });
}
Client function code:
userFactory().then(user => {
  console.log(user.get); // undefined
})
22 replies
DevSalmon
@DevSalmon2_twitter
dev1n
@dev1n:matrix.org
[m]
I believe you but I haven't seen anything like that in the recent years, I would be surprised if this is what I'm hitting in this case.
Jabis Sevon
@jabis
It's not your root cause, but as I said, you're setting up the promise incorrectly, to an event which might never get called, thus your chain remains empty on the .get part as it's actually not resolved
I just noted that I've ran into these weird const issues when dealing with JS prototypal inheritance (chains) earlier, so you might be wise to test :)
dev1n
@dev1n:matrix.org
[m]
If I return user directly (not in a promise), then there is no problem either. I will investigate more later, the problem might be in the framework and not gun.
Jabis Sevon
@jabis
promises change the this property so it might just destroy the binding
this usually being window or global but within gun chain it should be the gun instance
dev1n
@dev1n:matrix.org
[m]
I mean I made a test class with regular properties and methods and it wasn't broken.
Jabis Sevon
@jabis
a test class means zero - you have to look at how gun is constructed :)
2 replies
a lot of pre ES5 stuff happening
especially in the chaining functions
so context switch from window(.Gun) to Promise where you're trying to invoke the reactive gun.on listener easily can lose the actual context