sendNotice moved to own file

This commit is contained in:
0ceanSlim 2024-07-24 17:10:20 -04:00
parent 0dd29c5bcb
commit bde60b7046
2 changed files with 14 additions and 8 deletions

View File

@ -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))
}
}

View File

@ -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))
}