mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-31 00:56:32 +00:00
24 lines
709 B
Nim
24 lines
709 B
Nim
|
import system, results, std/json
|
||
|
import stew/byteutils
|
||
|
import ../../waku/common/base64, ./json_base_event
|
||
|
import ../../waku/waku_relay
|
||
|
|
||
|
type JsonTopicHealthChangeEvent* = ref object of JsonEvent
|
||
|
pubsubTopic*: string
|
||
|
topicHealth*: TopicHealth
|
||
|
|
||
|
proc new*(
|
||
|
T: type JsonTopicHealthChangeEvent, pubsubTopic: string, topicHealth: TopicHealth
|
||
|
): T =
|
||
|
# Returns a TopicHealthChange event as indicated in
|
||
|
# https://rfc.vac.dev/spec/36/#jsonmessageevent-type
|
||
|
|
||
|
return JsonTopicHealthChangeEvent(
|
||
|
eventType: "relay_topic_health_change",
|
||
|
pubsubTopic: pubsubTopic,
|
||
|
topicHealth: topicHealth,
|
||
|
)
|
||
|
|
||
|
method `$`*(jsonTopicHealthChange: JsonTopicHealthChangeEvent): string =
|
||
|
$(%*jsonTopicHealthChange)
|