Add read receipt, fix connection quality

This commit is contained in:
Jon Staab
2024-05-21 15:49:02 -07:00
parent 79a6253b90
commit eca11b4fb2
6 changed files with 14 additions and 12 deletions
+5 -4
View File
@@ -159,10 +159,11 @@ export class ConnectionMeta {
getSpeed = () => this.responseCount ? this.responseTimer / this.responseCount : 0
getStatus = () => {
if (this.authStatus === AuthStatus.Unauthorized) return ConnectionStatus.Unauthorized
if (this.authStatus === AuthStatus.Forbidden) return ConnectionStatus.Forbidden
if (this.lastFault > this.lastOpen) return ConnectionStatus.Error
if (this.lastClose > this.lastOpen) return ConnectionStatus.Closed
if (this.authStatus === AuthStatus.Unauthorized) return ConnectionStatus.Unauthorized
if (this.authStatus === AuthStatus.Forbidden) return ConnectionStatus.Forbidden
if (this.lastOpen === 0) return ConnectionStatus.Closed
if (this.lastFault > this.lastOpen) return ConnectionStatus.Error
if (this.lastClose > this.lastOpen) return ConnectionStatus.Closed
if (this.getSpeed() > 1000) return ConnectionStatus.Slow
return ConnectionStatus.Ok
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@welshman/net",
"version": "0.0.7",
"version": "0.0.8",
"author": "hodlbod",
"license": "MIT",
"description": "Utilities for connecting with nostr relays.",
@@ -32,7 +32,7 @@
},
"dependencies": {
"@welshman/lib": "0.0.6",
"@welshman/util": "0.0.8",
"@welshman/util": "0.0.9",
"isomorphic-ws": "^5.0.0",
"ws": "^8.16.0"
}