clean, add http ping to connected servers

This commit is contained in:
marlon-erler
2026-04-01 17:44:12 +00:00
parent 6d7ef89355
commit 3545606399
4 changed files with 8 additions and 5 deletions
+1 -2
View File
@@ -119,7 +119,6 @@ async function main() {
// CLI
function updateCLI() {
return;
console.clear();
console.log(Colors.bold.bgWhite("UNIVERSAL DECENTRALIZED NETWORK"));
@@ -146,7 +145,7 @@ async function main() {
}
removeExpiredMailboxes();
}, 2000);
}, 5000);
// FINISH
writeSuccess(`###\nstarted up ${new Date().toLocaleString()}`);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "udn",
"version": "1.0.0-beta15",
"version": "1.0.0-beta16",
"description": "A websocket-based infrastructure for decentralized networks ",
"bin": {
"start": "index.ts"
-2
View File
@@ -93,8 +93,6 @@ export class Mailbox implements Subscriber {
send(message: string, _?: boolean, uuid?: string): void {
this._ws?.send(message);
console.log(this.id, uuid, message, "sending");
if (!uuid) return;
this.messages.set(uuid, message);
}
+6
View File
@@ -100,6 +100,12 @@ export function connectServers(config: typeof defaultConfig): void {
}
export function reconnectServers(config: typeof defaultConfig): void {
config.connectedServers
.map(address => address.replace("ws", "http"))
.forEach(address => {
fetch(address);
});
[...serversDisconnected.values()].forEach((address) => {
connectServer(address, config);
});