Skip to content

Commit 823e04e

Browse files
committed
Updated monitoring
Signed-off-by: Robert Gogete <gogeterobert@yahoo.com>
1 parent 327a73d commit 823e04e

File tree

1 file changed

+2
-42
lines changed

1 file changed

+2
-42
lines changed

src/relay.ts

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -132,47 +132,6 @@ async function startRelay(): Promise<void> {
132132

133133
// Monitor data changes with Gun.js map/on
134134
console.log('🔍 Setting up data monitoring...');
135-
136-
// Monitor all data changes in the registry
137-
gun.get('dig-nat-tools').map().on((data: Record<string, unknown> | null, key: string) => {
138-
if (data && key) {
139-
const timestamp = new Date().toISOString();
140-
console.log(`📊 [${timestamp}] Data updated in 'dig-nat-tools':`, {
141-
key: key,
142-
hasData: !!data,
143-
dataKeys: data ? Object.keys(data).filter(k => k !== '_') : []
144-
});
145-
}
146-
});
147-
148-
// Monitor test namespace as well
149-
gun.get('dig-nat-tools-test').map().on((data: Record<string, unknown> | null, key: string) => {
150-
if (data && key) {
151-
const timestamp = new Date().toISOString();
152-
console.log(`📊 [${timestamp}] Data updated in 'dig-nat-tools-test':`, {
153-
key: key,
154-
hasData: !!data,
155-
dataKeys: data ? Object.keys(data).filter(k => k !== '_') : []
156-
});
157-
}
158-
});
159-
160-
// Monitor host registrations specifically
161-
gun.get('dig-nat-tools').get('hosts').map().on((data: Record<string, unknown> | null, key: string) => {
162-
if (data && key) {
163-
const timestamp = new Date().toISOString();
164-
if (data === null || data === undefined) {
165-
console.log(`🗑️ [${timestamp}] Host unregistered: ${key}`);
166-
} else {
167-
console.log(`🏠 [${timestamp}] Host registered/updated: ${key}`, {
168-
storeId: data.storeId || 'unknown',
169-
lastSeen: data.lastSeen ? new Date(data.lastSeen as number).toLocaleString() : 'unknown',
170-
directHttp: data.directHttp_available || false,
171-
webTorrent: data.webTorrent_available || false
172-
});
173-
}
174-
}
175-
});
176135

177136
gun.get('dig-nat-tools-test').get('hosts').map().on((data: Record<string, unknown> | null, key: string) => {
178137
if (data && key) {
@@ -184,7 +143,8 @@ async function startRelay(): Promise<void> {
184143
storeId: data.storeId || 'unknown',
185144
lastSeen: data.lastSeen ? new Date(data.lastSeen as number).toLocaleString() : 'unknown',
186145
directHttp: data.directHttp_available || false,
187-
webTorrent: data.webTorrent_available || false
146+
webTorrent: data.webTorrent_available || false,
147+
magnetUris: data.webTorrent_magnetUris || []
188148
});
189149
}
190150
}

0 commit comments

Comments
 (0)