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
+4 -4
View File
@@ -3062,7 +3062,7 @@
"version": "0.0.6", "version": "0.0.6",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@welshman/util": "0.0.8" "@welshman/util": "0.0.9"
}, },
"devDependencies": { "devDependencies": {
"gts": "^5.0.1", "gts": "^5.0.1",
@@ -3096,11 +3096,11 @@
}, },
"packages/net": { "packages/net": {
"name": "@welshman/net", "name": "@welshman/net",
"version": "0.0.7", "version": "0.0.8",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@welshman/lib": "0.0.6", "@welshman/lib": "0.0.6",
"@welshman/util": "0.0.8", "@welshman/util": "0.0.9",
"isomorphic-ws": "^5.0.0", "isomorphic-ws": "^5.0.0",
"ws": "^8.16.0" "ws": "^8.16.0"
}, },
@@ -3112,7 +3112,7 @@
}, },
"packages/util": { "packages/util": {
"name": "@welshman/util", "name": "@welshman/util",
"version": "0.0.8", "version": "0.0.9",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@welshman/lib": "0.0.6", "@welshman/lib": "0.0.6",
+1 -1
View File
@@ -31,6 +31,6 @@
"typescript": "~5.1.6" "typescript": "~5.1.6"
}, },
"dependencies": { "dependencies": {
"@welshman/util": "0.0.8" "@welshman/util": "0.0.9"
} }
} }
+5 -4
View File
@@ -159,10 +159,11 @@ export class ConnectionMeta {
getSpeed = () => this.responseCount ? this.responseTimer / this.responseCount : 0 getSpeed = () => this.responseCount ? this.responseTimer / this.responseCount : 0
getStatus = () => { getStatus = () => {
if (this.authStatus === AuthStatus.Unauthorized) return ConnectionStatus.Unauthorized if (this.authStatus === AuthStatus.Unauthorized) return ConnectionStatus.Unauthorized
if (this.authStatus === AuthStatus.Forbidden) return ConnectionStatus.Forbidden if (this.authStatus === AuthStatus.Forbidden) return ConnectionStatus.Forbidden
if (this.lastFault > this.lastOpen) return ConnectionStatus.Error if (this.lastOpen === 0) return ConnectionStatus.Closed
if (this.lastClose > this.lastOpen) 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 if (this.getSpeed() > 1000) return ConnectionStatus.Slow
return ConnectionStatus.Ok return ConnectionStatus.Ok
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@welshman/net", "name": "@welshman/net",
"version": "0.0.7", "version": "0.0.8",
"author": "hodlbod", "author": "hodlbod",
"license": "MIT", "license": "MIT",
"description": "Utilities for connecting with nostr relays.", "description": "Utilities for connecting with nostr relays.",
@@ -32,7 +32,7 @@
}, },
"dependencies": { "dependencies": {
"@welshman/lib": "0.0.6", "@welshman/lib": "0.0.6",
"@welshman/util": "0.0.8", "@welshman/util": "0.0.9",
"isomorphic-ws": "^5.0.0", "isomorphic-ws": "^5.0.0",
"ws": "^8.16.0" "ws": "^8.16.0"
} }
+1
View File
@@ -20,6 +20,7 @@ export const GROUP_CHAT_THREAD = 11
export const GROUP_CHAT_THREAD_REPLY = 12 export const GROUP_CHAT_THREAD_REPLY = 12
export const SEAL = 13 export const SEAL = 13
export const DIRECT_MESSAGE = 14 export const DIRECT_MESSAGE = 14
export const READ_RECEIPT = 15
export const GENERIC_REPOST = 16 export const GENERIC_REPOST = 16
export const CHANNEL_CREATE = 40 export const CHANNEL_CREATE = 40
export const CHANNEL_UPDATE = 41 export const CHANNEL_UPDATE = 41
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@welshman/util", "name": "@welshman/util",
"version": "0.0.8", "version": "0.0.9",
"author": "hodlbod", "author": "hodlbod",
"license": "MIT", "license": "MIT",
"description": "A collection of nostr-related utilities.", "description": "A collection of nostr-related utilities.",