diff --git a/relay/handlers/kinds/kind0.go b/relay/handlers/kinds/kind0.go index 4bf9bd1..cc2d749 100644 --- a/relay/handlers/kinds/kind0.go +++ b/relay/handlers/kinds/kind0.go @@ -2,7 +2,6 @@ package kinds import ( "context" - "encoding/json" "fmt" relay "grain/relay/types" @@ -50,10 +49,4 @@ func HandleKind0(ctx context.Context, evt relay.Event, collection *mongo.Collect fmt.Println("Upserted event kind 0 into MongoDB:", evt.ID) return nil -} - -func sendNotice(ws *websocket.Conn, pubKey, message string) { - notice := []interface{}{"NOTICE", pubKey, message} - noticeBytes, _ := json.Marshal(notice) - websocket.Message.Send(ws, string(noticeBytes)) -} +} \ No newline at end of file diff --git a/relay/handlers/kinds/notice.go b/relay/handlers/kinds/notice.go new file mode 100644 index 0000000..6713c0b --- /dev/null +++ b/relay/handlers/kinds/notice.go @@ -0,0 +1,13 @@ +package kinds + +import ( + "encoding/json" + + "golang.org/x/net/websocket" +) + +func sendNotice(ws *websocket.Conn, pubKey, message string) { + notice := []interface{}{"NOTICE", pubKey, message} + noticeBytes, _ := json.Marshal(notice) + websocket.Message.Send(ws, string(noticeBytes)) +}