Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot subscribe to a node in another user's space before it's created #893

Open
mmalmi opened this issue Jan 24, 2020 · 0 comments
Open

Comments

@mmalmi
Copy link
Collaborator

mmalmi commented Jan 24, 2020

var gun1 = new Gun({peers:['https://gunjs.herokuapp.com/gun'], radisk: false, localStorage: false});
var gun2 = new Gun({peers:['https://gunjs.herokuapp.com/gun'], radisk: false, localStorage: false});
var gun3 = new Gun({peers:['https://gunjs.herokuapp.com/gun'], radisk: false, localStorage: false});
Gun.SEA.pair().then(pair => {
  // This console.log is not called:
  gun1.user(pair.pub).get('chats').get('someChatID').get('msgs').map().on(msg => console.log(1, msg)); 
  var user = gun2.user();
  user.auth(pair);
  user.get('chats').get('someChatID').get('msgs').get(new Date().toISOString()).put({text:'hello world'});
  setTimeout(() => {
    // Only this console.log is called.
    // If you change gun3 -> gun1 (resubscribe), both console.logs are called.
    // Also, if you change .on -> .once, it prints an empty object.
    gun3.user(pair.pub).get('chats').get('someChatID').get('msgs').map().on(msg => console.log(2, msg));
  }, 2000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant