naming oversight
This commit is contained in:
parent
a513408866
commit
e5e18ca28c
@ -130,8 +130,8 @@ export type OutgoingMessage =
|
|||||||
|
|
||||||
export const enum OutgoingKind {
|
export const enum OutgoingKind {
|
||||||
Event,
|
Event,
|
||||||
Subscription,
|
OpenSubscription,
|
||||||
Unsubscription,
|
CloseSubscription,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,7 +146,7 @@ export interface OutgoingEvent {
|
|||||||
* Outgoing "REQ" message, which opens a subscription.
|
* Outgoing "REQ" message, which opens a subscription.
|
||||||
*/
|
*/
|
||||||
export interface OutgoingOpenSubscription {
|
export interface OutgoingOpenSubscription {
|
||||||
kind: OutgoingKind.Subscription
|
kind: OutgoingKind.OpenSubscription
|
||||||
id: SubscriptionId
|
id: SubscriptionId
|
||||||
filters: Filters[]
|
filters: Filters[]
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ export interface OutgoingOpenSubscription {
|
|||||||
* Outgoing "CLOSE" message, which closes a subscription.
|
* Outgoing "CLOSE" message, which closes a subscription.
|
||||||
*/
|
*/
|
||||||
export interface OutgoingCloseSubscription {
|
export interface OutgoingCloseSubscription {
|
||||||
kind: OutgoingKind.Unsubscription
|
kind: OutgoingKind.CloseSubscription
|
||||||
id: SubscriptionId
|
id: SubscriptionId
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,13 +219,13 @@ function serializeOutgoingMessage(msg: OutgoingMessage): string {
|
|||||||
const raw =
|
const raw =
|
||||||
msg.event instanceof SignedEvent ? msg.event.serialize() : msg.event
|
msg.event instanceof SignedEvent ? msg.event.serialize() : msg.event
|
||||||
return JSON.stringify(["EVENT", raw])
|
return JSON.stringify(["EVENT", raw])
|
||||||
} else if (msg.kind === OutgoingKind.Subscription) {
|
} else if (msg.kind === OutgoingKind.OpenSubscription) {
|
||||||
return JSON.stringify([
|
return JSON.stringify([
|
||||||
"REQ",
|
"REQ",
|
||||||
msg.id.toString(),
|
msg.id.toString(),
|
||||||
...serializeFilters(msg.filters),
|
...serializeFilters(msg.filters),
|
||||||
])
|
])
|
||||||
} else if (msg.kind === OutgoingKind.Unsubscription) {
|
} else if (msg.kind === OutgoingKind.CloseSubscription) {
|
||||||
return JSON.stringify(["CLOSE", msg.id.toString()])
|
return JSON.stringify(["CLOSE", msg.id.toString()])
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`invalid message: ${JSON.stringify(msg)}`)
|
throw new Error(`invalid message: ${JSON.stringify(msg)}`)
|
||||||
|
@ -107,7 +107,7 @@ export class Nostr {
|
|||||||
for (const [key, filters] of this.#subscriptions.entries()) {
|
for (const [key, filters] of this.#subscriptions.entries()) {
|
||||||
const subscriptionId = new SubscriptionId(key)
|
const subscriptionId = new SubscriptionId(key)
|
||||||
conn.send({
|
conn.send({
|
||||||
kind: OutgoingKind.Subscription,
|
kind: OutgoingKind.OpenSubscription,
|
||||||
id: subscriptionId,
|
id: subscriptionId,
|
||||||
filters,
|
filters,
|
||||||
})
|
})
|
||||||
@ -171,7 +171,7 @@ export class Nostr {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
conn.send({
|
conn.send({
|
||||||
kind: OutgoingKind.Subscription,
|
kind: OutgoingKind.OpenSubscription,
|
||||||
id: subscriptionId,
|
id: subscriptionId,
|
||||||
filters,
|
filters,
|
||||||
})
|
})
|
||||||
@ -193,7 +193,7 @@ export class Nostr {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
conn.send({
|
conn.send({
|
||||||
kind: OutgoingKind.Unsubscription,
|
kind: OutgoingKind.CloseSubscription,
|
||||||
id: subscriptionId,
|
id: subscriptionId,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user