From 4d34cb8dfe683a721c697a6d78965324c42fc3d7 Mon Sep 17 00:00:00 2001 From: jkoberg Date: Fri, 18 Aug 2023 11:22:54 +0200 Subject: [PATCH] sse event Signed-off-by: jkoberg --- changelog/unreleased/add-sse-event.md | 5 +++++ pkg/events/sse.go | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 changelog/unreleased/add-sse-event.md create mode 100644 pkg/events/sse.go diff --git a/changelog/unreleased/add-sse-event.md b/changelog/unreleased/add-sse-event.md new file mode 100644 index 0000000000..02b7d5a409 --- /dev/null +++ b/changelog/unreleased/add-sse-event.md @@ -0,0 +1,5 @@ +Enhancement: Add sse event + +Adds an event to issue sse notifications + +https://github.com/cs3org/reva/pull/4119 diff --git a/pkg/events/sse.go b/pkg/events/sse.go new file mode 100644 index 0000000000..34841c81f3 --- /dev/null +++ b/pkg/events/sse.go @@ -0,0 +1,19 @@ +package events + +import ( + "encoding/json" +) + +// SendSEE instructs the sse service to send a notification to a user +type SendSSE struct { + UserID string + Type string + Message []byte +} + +// Unmarshal to fulfill umarshaller interface +func (SendSSE) Unmarshal(v []byte) (interface{}, error) { + e := SendSSE{} + err := json.Unmarshal(v, &e) + return e, err +}