clean, add http ping to connected servers
This commit is contained in:
@@ -119,7 +119,6 @@ async function main() {
|
|||||||
|
|
||||||
// CLI
|
// CLI
|
||||||
function updateCLI() {
|
function updateCLI() {
|
||||||
return;
|
|
||||||
console.clear();
|
console.clear();
|
||||||
|
|
||||||
console.log(Colors.bold.bgWhite("UNIVERSAL DECENTRALIZED NETWORK"));
|
console.log(Colors.bold.bgWhite("UNIVERSAL DECENTRALIZED NETWORK"));
|
||||||
@@ -146,7 +145,7 @@ async function main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
removeExpiredMailboxes();
|
removeExpiredMailboxes();
|
||||||
}, 2000);
|
}, 5000);
|
||||||
|
|
||||||
// FINISH
|
// FINISH
|
||||||
writeSuccess(`###\nstarted up ${new Date().toLocaleString()}`);
|
writeSuccess(`###\nstarted up ${new Date().toLocaleString()}`);
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "udn",
|
"name": "udn",
|
||||||
"version": "1.0.0-beta15",
|
"version": "1.0.0-beta16",
|
||||||
"description": "A websocket-based infrastructure for decentralized networks ",
|
"description": "A websocket-based infrastructure for decentralized networks ",
|
||||||
"bin": {
|
"bin": {
|
||||||
"start": "index.ts"
|
"start": "index.ts"
|
||||||
|
|||||||
@@ -93,8 +93,6 @@ export class Mailbox implements Subscriber {
|
|||||||
send(message: string, _?: boolean, uuid?: string): void {
|
send(message: string, _?: boolean, uuid?: string): void {
|
||||||
this._ws?.send(message);
|
this._ws?.send(message);
|
||||||
|
|
||||||
console.log(this.id, uuid, message, "sending");
|
|
||||||
|
|
||||||
if (!uuid) return;
|
if (!uuid) return;
|
||||||
this.messages.set(uuid, message);
|
this.messages.set(uuid, message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,12 @@ export function connectServers(config: typeof defaultConfig): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function reconnectServers(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) => {
|
[...serversDisconnected.values()].forEach((address) => {
|
||||||
connectServer(address, config);
|
connectServer(address, config);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user