revert "a function to send an event directly to a specific connection."

this reverts commit e9c9d0c3a7b6ace94cd40e04d74e4ffd31b6b898 because it is not a good idea and probably useless.
This commit is contained in:
fiatjaf 2024-10-16 15:07:44 -03:00
parent 9069341657
commit d4334ac2bb
2 changed files with 1 additions and 9 deletions

View File

@ -140,7 +140,7 @@ func (rl *Relay) notifyListeners(event *nostr.Event) {
return return
} }
} }
listener.ws.SendEvent(listener.id, *event) listener.ws.WriteJSON(nostr.EventEnvelope{SubscriptionID: &listener.id, Event: *event})
} }
} }
} }

View File

@ -6,7 +6,6 @@ import (
"sync" "sync"
"github.com/fasthttp/websocket" "github.com/fasthttp/websocket"
"github.com/nbd-wtf/go-nostr"
) )
type WebSocket struct { type WebSocket struct {
@ -39,10 +38,3 @@ func (ws *WebSocket) WriteMessage(t int, b []byte) error {
defer ws.mutex.Unlock() defer ws.mutex.Unlock()
return ws.conn.WriteMessage(t, b) return ws.conn.WriteMessage(t, b)
} }
func (ws *WebSocket) SendEvent(subscriptionId string, event nostr.Event) error {
return ws.WriteJSON(nostr.EventEnvelope{
SubscriptionID: &subscriptionId,
Event: event,
})
}