Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 03 04:33
    ndaidong closed #1292
  • Dec 01 16:01
    ameoba32 opened #1295
  • Dec 01 07:28

    amark on master

    toString must be stringy! (compare)

  • Dec 01 05:29
    amark commented #1287
  • Dec 01 05:21
    amark commented #1289
  • Dec 01 05:20
    amark commented #1293
  • Dec 01 05:12
    amark commented #1294
  • Nov 30 08:27
    soulofmischief commented #1294
  • Nov 28 23:07
    ViteOrder opened #1294
  • Nov 24 06:51
    expelledboy synchronize #1276
  • Nov 22 18:04
    BrendanDN commented #1290
  • Nov 22 18:04
    BrendanDN closed #1290
  • Nov 22 18:04
    BrendanDN commented #1290
  • Nov 22 17:59
    BrendanDN commented #1292
  • Nov 22 04:07
    ndaidong commented #1292
  • Nov 21 20:28
    verschmelzen opened #1293
  • Nov 21 19:44
    BrendanDN commented #1292
  • Nov 21 14:50
    ndaidong opened #1292
  • Nov 19 17:41
    estebanrfp commented #1080
  • Nov 18 21:26
    @rogowski banned @jesus:halogen.city
Muhammad Hassan Bilal
@hassan-bilal144
  • To send a message, I encrypt it first (different encryption key for sender and receiver) and then put the encrypted string on the sender user's space (chat/timestamp) path and then on the same path of the other user by using their certificate.
  • This works for the first two aur three message conversations on both sides (sender and receiver ) but then randomly the code gets stuck where it has to write on the other user's space using the certificate
3 replies
Muhammad Hassan Bilal
@hassan-bilal144
I'm using certificate so that the user is bound to include their pub key in the path while writing to other users space so it prevents one user to override another user's data
The timestamp string also makes sure that one message of same user doesn't override the other
@amark
Anas Abdullah Saber
@Anas2001
What this warning message mean "reusing same fs store and options as 1st" ?
3 replies
phaze-jeff
@phaze-jeff:matrix.org
[m]
if two completely different apps happen to use the same key for the gun.get() function, wouldn't this cause problems? do keys need to be unique to avoid this?
2 replies
Anas Abdullah Saber
@Anas2001
@phaze-jeff:matrix.org which problem? If you mean race condition you can prevent it if each app use the same key in their own private graph or you can use content address method
Anas Abdullah Saber
@Anas2001
It's possible to query big list in graph with lazy load? If yes how?
Muhammad Hassan Bilal
@hassan-bilal144
Hi everyone, I've narrowed down my previous issue to the put operation being faulty. If we are writing on user space and our path is like 4-5 nodes long the code will keep awaiting on the callback of the put operation forever which will never run. For example gun.user(<pubkey>).get('something').get('something').get('something').get('something').put({helloworld: 'helloworld'}) will never run it's callback function. If we write on public space, the put operations runs smoothly no matter how long the path is. Any help with this will be appreciated
2 replies
@amark
Brad Stewart
@bradstewart:matrix.org
[m]
Hi everyone, just joined the room. I'm considering migrating my existing application from Firebase to GUN. The application's use case is small team CRUD operations in offline environments. So far Firestore's offline persistence is my only option and I'm keen to migrate to GUN. I'm also testing RxDB and OrbitDB. Where GUN would excel I think is P2P. Currently using Firestore, my users have to return to an internet connection for all the clients to sync. With GUN, my users could take a WiFi hotspot into the field and sync all clients without internet - am I understanding that correctly? If anyone has any thoughts, experience or pitfalls, I would appreciate it.
Manwë
@Manwe-777
@bradstewart:matrix.org that's not entirely correct, your users will need to connect to have others see their changes. The order of the connections can be completely asynchronous, but thei WILL need internet at some point to sync up.
8 replies
Mark Nadal
@amark
Screen Shot 2022-12-05 at 12.57.35 AM.png
@hassan-bilal144 tried to replicate, seems to be here? Maybe you're not waiting until you're logged in? I get ack ok & see it in localstorage ^ . Tho I'm sure I'm missing an edge case that you can help me replicate?
2 replies
@Anas2001 large lists get streamed incrementally. Tho correct, better to paginate - this is a bit tedious right now (with lexical cursors) and will be replaced with something much easier, Book's binary search for RAD will do automatic pagination for any query, but that is a long ways out (tho Scott starting to help on it as well!).
Mark Nadal
@amark
@soulofmischief think you can add that as a unit test? There are similar ones, hope I'm not missing an edge case, so this would be good to add.
Tyler and I got some pretty significant progress towards Secure Render curves working today! I'll ping Dan to see if can loop back to AXE. And hopefully can get better repeats with Scott on Book/RAD.
soulofmischief
@soulofmischief
how are people currently handing RAD's ENAMETOOLONG error on userspace?
my graph is only 2 levels deep
seems like an unresolved issue on GH

@soulofmischief think you can add that as a unit test? There are similar ones, hope I'm not missing an edge case, so this would be good to add.

no problem

what I did to get around the problem for now was get rid of load() and once() in as many places as possible
and I enabled a relay
I think the issue crops up without a relay and might have to do with the put/ack lack problem
i'll get on that today
davidmaxwaterman
@davidmaxwaterman:mozilla.org
[m]
QQ: What is this message trying to tell me?
chain not yet supported for
2 replies
Bo
@worldpeaceenginelabs
@amark check out https://github.com/pubkey/rxdb#--what-is-rxdb (i like the description, better to grasp if one is new to Gun)
It does the same as Gun as it seems. Maybe a good inspiration for a Gun readme.md update "What is Gun" ???
davidmaxwaterman
@davidmaxwaterman:mozilla.org
[m]
chain not yet supported for 
Object { "0.children.3.children.0": "{\"title\":\"New Folder\",\"type\":\"folder\"}" }
 ... 
Object { "$": {…}, root: {…}, id: 2, back: {…}, on: onto(tag, arg, as)
, tag: {…}, get: "testing", soul: "testing", any: {…}, ask: {…}, … }

Object { "$": {…}, root: {…}, id: 2, back: {…}, on: onto(tag, arg, as), tag: {…}, get: "testing", soul: "testing", any: {…}, ask: {…}, … }
 ...
davidmaxwaterman
@davidmaxwaterman:mozilla.org
[m]
Aha, I had deleted '_' from the object itself, instead of making a copy and deleting it from that...maybe.
2 replies
davidmaxwaterman
@davidmaxwaterman:mozilla.org
[m]
It seems lint is a bit fussy about '_' not being used - that's annoying :/
davidmaxwaterman
@davidmaxwaterman:mozilla.org
[m]
:pointup: Edit: It seems lint is a bit fussy about '\' not being used - that's annoying :/ (hint: // eslint-disable-line no-unused-vars)
Bo
@worldpeaceenginelabs
@bradstewart:matrix.org if you have a mobile wifi router and a rasberry pi or similar mobile nodejs server (needed for the gun relay) your scenario will work pretty much out of the box.
2 replies
atordvairn
@atordvairn
anywhere else i can host my relay exept for heroku?
2 replies
Parker Queen
@parkerqueen

@amark The following function succeeds once but all the subsequent attempts fail. We've replicated this on two different applications and are pretty sure it's either our misunderstanding of Gun's API or a bug inside Gun itself.

P.S: Not using AXE. Gets stuck with or without a relay server. Using in a Next.js/React application.

const sendMessage = async (receiverPubkey, message) => {
    const userinfo = gun.user().is;
    const random = Math.floor(Math.random() * 1000000).toString();

    if (!userinfo) {
      throw new Error('User not logged in');
    }

    //creating the message object.
    const messageObj = JSON.stringify({
      message: message,
      sender: userinfo?.pub,
      receiver: receiverPubkey,
    });

    console.log('PUTTING MESSAGE COPY');
    const ack = await new Promise((resolve, reject) => {
      gun
        // @ts-ignore
        .user(userinfo?.pub)
        .get('smartswapchat')
        .get(receiverPubkey)
        .get('something')
        .get('something')
        .get('something')
        .get('something')
        .get('something')
        .get('something')
        .get('something')
        .get('something')
        .get(random.toString())
        .put({ msg: messageObj, type: 'selfWrite' }, (ack) => resolve(ack));
    });
    console.log('PUTTING MESSAGE COPY DONE');

    return ack;
  };
2 replies
One thing of import: it always works if you remove the last .get(random.toString())
Bo
@worldpeaceenginelabs

@bradstewart:matrix.org There are even lte modules for rasberry pi, for instance https://www.rasppishop.de/4G-LTE-HAT
(advantage: you can run it on batteries)

But if you have a base, you could simply run a notebook (refurbished thinkpads available starting at 199€) either with integrated lte or an usb lte stick, to run a wifi hotspot which syncs on connection. or simply whatever wifi you use anyway.
When your teammates arrive after a day collecting data, they simply connect to the wifi hotspot and the gun relay on the notebook will sync.
(you could also place the notebook in the middle of your teammates surveillance area to have it syncing real-time. if the wifi is strong enough, which on flat areas is)

solcryptic
@solcryptic
Hi everyone
i have a chat app that i made using gun js and i have stored chats in form : { unique_key : { date_time : 9/2/22_3:5:55 , message: abcd , sender: address } } inside the gun node. So when I have to render chats between two friends, I first get all the chats between them, store in react variable(state) and then sort them on the basis of the date and time but it doesn't seem to be a good practice as it takes more time to fetch all the chats and sort them
Do you guys know a better way to store chats and fetch them bit by bit and not all the chats at the same time (like whatsapp)?
1 reply
Nabil Cheikh
@ncheikh_gitlab
@amark hello, I have a relay server setup and when I connect via a browser peer I cannot query anything belonging to another user on the relay peer. I assumed (possibly improperly) that if I ran a get it would query across nodes to get what is needed. Am I incorrect or is something not working properly?
1 reply
davidmaxwaterman
@davidmaxwaterman:mozilla.org
[m]
Is there a up-to-date high level guide on how to implement user accounts? I want users to share a peer relay, but each only have access to their own 'sub-tree' of data. Also, how to implement an 'admin' account?
7 replies
Lexi
@Lexi:matrix.org
[m]
Hmm the keys as opposed to the data you mean? I think keys don't get encrypted but it would be easy to do or to give them randomly generated names like set does
davidmaxwaterman
@davidmaxwaterman:mozilla.org
[m]
They represent the structure of data on my client, ie a 'path' to the actual data - eg 'a.b.c.d' where each is a node in the tree...so I can't randomise them...unless there is lookup table alongside which has a generic name and maps from the random names to the path/key in the real data.
...or just JSON.stringify the whole lot and encrypt that?
Lexi
@Lexi:matrix.org
[m]
I'd go for the first solution but if updates are rare I guess stringifying is okay too
2 replies
davidmaxwaterman
@davidmaxwaterman:mozilla.org
[m]
Yeah, makes sense if I add that user(pub) into the chain...
Ilya Shulepov
@KernelMrex

Hi! I have a problem that gun is not calling hook

export default class Datastore
{
    /** @type {IGunChain} usersChain*/
    usersChain;

    /**
     * @param {IGunInstance<any>} gun
     */
    constructor(gun)
    {
        this.usersChain = gun.get('users')
    }

    subscribeOnUsersUpdate(callback)
    {
        this.usersChain.map().on((node, id) => {
            console.log('gun cb called', node, id);
        });
    }

    unsubscribeOnUsersUpdate(callback)
    {
         // TODO
    }
}

When i type in browser

Gun().get('users').set({name: "gfdgreg"})

So, where may be a problem?

15 replies
Bo
@worldpeaceengine:matrix.org
[m]

@amark: Hey Marc. How you doing? What do you think about RxDB https://rxdb.info/ and what could we learn for Gun from it?

I like the feature most, that rxdb is able to use existing infrastructure like couchdb (CouchDB Replication Protocol: sounds like AXE to me?), graphql, websocket, p2p, storage layers... (just like the gun adapters) and the website seems very developer friendly (you could replace rxdb with Gun on their website and it reads exactly like the description of Gun to me)

Bo
@worldpeaceengine:matrix.org
[m]

Personally i like Gun's syntax better. Its simpler.

But the rxdb syntax is also nice and logically comprehensible.

With Gun sometimes i get the impression i am working with patches (array not supported out of the box for instance)

But no critics! I love Gun, i love you helpful dev guys, i love you Marc 😘🤣

But i hope Gun gets more mature in the near future on these terms... (arrays!!!, documentation, how to's)

I will try to create a page (Gun in 10 bullet points/Gun Quickstart) into the Gun Wiki the next days, which will read easy as the mainpage and the quickstart page of rxdb (https://rxdb.info/quickstart.html)

Bo
@worldpeaceenginelabs
sorry, i meant Mar(k) 😅