clean, add http ping to connected servers
This commit is contained in:
@@ -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
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user