Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
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
Mark Nadal
@amark
@joshbenaron https://github.com/brysgo/graphql-gun ! Tho it needs to be upgraded to latest version (anyone want to help? I can do a screencall).
@adam_blvck:matrix.org :+1: .
@scorezeny:matrix.org :clap: yay Martti!
@agursoy :clap: @Lexi:matrix.org @alterx @draeder . If you can get them to all connect to the same WiFi network, you can run it all locally! (tho be prepared to deal with SSL certs & junk problems like that).
Meething team has done Audio, so it works, its just that its not easy (requires manually appending buffers, different support in Safari, etc.) without "hiccups".
@draeder :clap: @i001962:matrix.org !
@verschmelzen:matrix.org WebRTC SDPs are mystical, eh? :P I'm shocked I could compress it into such a few lines - were you able to figure it out? GUN might start to confuse your video/audio channels tho, thinking they're valid DAM peers. No? Were you able to get it to work?
@tf2_pyro:matrix.thisisjoes.site :clap: @rococtz:matrix.org . :fire: ;) GUN is smart, glad you like. :clap: @Lexi:matrix.org . Gonna get even smarter with Book's "nearest data pages" too! Hopefully within 6 to 9 months?
@timsim00 :clap: @draeder . & Iris - but its code base is deep. Also, check out @nsreed 's "multiplayer whiteboard with ACL" demo & ask for code link ( https://twitter.com/marknadal/status/1552740681554092033 ).
@mikelun :clap: @Lexi:matrix.org :clap: @alterx . Yes .put( is dumb simple, .set( is a convenience wrapper that covers 2+ "array-like" edge cases: Loosely-Ordered Appends & Mathematical Sets (tables), but likewise, requires more understanding to use / checking docs. I'd love if this could be simplified, but like with ACLs, the nature of these things in any system (centralized or not) have nuances to them. Honestly, that is why I prefer more key/value object stores: they're pretty dumb simple & predictable to use.
@leoncstew :clap: @draeder . RAD is gonna get major update with Book power - so if you're willing, would love help there (and note, meanwhile, RAD is not updated to latest GUN so there are quite a few issues presently).
@acblackburn lovely use case! Correct. 2 things to be aware of / help you out: (A) just put(formData) not put({data: formData}), (B) doing .put(null) nulls out the LINK to the data (GUN is a graph database), it doesn't null the data itself, unless (C) you serialize your formData as a string? (maybe a bad idea), then when you do .put("the form data") and later .put(null) the null overwrites the bytes of the previous string/text, because the data was saved in-place not as a link to another data node.
... still catching up ... will continue more later ...
1 reply
verschmelzen
@verschmelzen:matrix.org
[m]
I guess I have found root.on source code, but I have no idea what happens here 🤷
tedd pasta
@azdez:matrix.org
[m]
is lexical queries fixed yet? i remember trying to paginate and the lex queries did not work as it should have.
DevSalmon
@DevSalmon2_twitter
Hey guys, sorry for this seemingly silly question, but auth on different devices doesn’t seem to work unless I spam sign in, related to https://stackoverflow.com/questions/69070363/gunjs-user-not-getting-authenticated-in-incognito-window. Am I missing something?
Daniel Raeder
@draeder
@azdez:matrix.org I don't think so..Gun's DHT has taken priority, making a lot of progress (incremental though!) with @amark
4 replies
DevSalmon
@DevSalmon2_twitter
Thanks!