logos-messaging-nim/library/events/json_connection_change_event.nim

18 lines
533 B
Nim
Raw Normal View History

2025-01-08 18:53:00 +01:00
import system, std/json, libp2p/[connmanager, peerid]
import ../../waku/common/base64, ./json_base_event
type JsonConnectionChangeEvent* = ref object of JsonEvent
peerId*: string
peerEvent*: PeerEventKind
proc new*(
T: type JsonConnectionChangeEvent, peerId: string, peerEvent: PeerEventKind
): T =
return JsonConnectionChangeEvent(
eventType: "connection_change", peerId: peerId, peerEvent: peerEvent
)
method `$`*(jsonConnectionChangeEvent: JsonConnectionChangeEvent): string =
$(%*jsonConnectionChangeEvent)