In GUN, how can I check if the peer (relay server) is connected?
I'm trying to create a multiplayer game with GUN.
I made some tests with two browsers opened at the same time and noticed sometimes the changes in one window are not updating the other.
So, I would like to check if the problem is with the connection / peer.
I'm using this GUN relay URL: https://gun-manhattan.herokuapp.com/gun
How do I check if the relay is connected?
index.html
Relay URL:
Root node name:
Node name:
gunjs-test.js
let gun = null;
function initGun(url) {
gun = Gun([url]);
}
function enableRealtimeUpdates(rootNodeName, nodeName) {
gun.get(rootNodeName).get(nodeName).on((data, id) => {
console.log("id: " + id);
console.log("data: " + data);
});
}
function isConnected() {
// ???
}