Skip to content

Commit

Permalink
tmp sse
Browse files Browse the repository at this point in the history
Signed-off-by: jkoberg <[email protected]>
  • Loading branch information
kobergj committed Aug 21, 2023
1 parent 9b5c27f commit 5226153
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ config = {
"services/search",
"services/settings",
"services/sharing",
"services/sse",
"services/storage-system",
"services/storage-publiclink",
"services/storage-shares",
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ OCIS_MODULES = \
services/search \
services/settings \
services/sharing \
services/sse \
services/storage-system \
services/storage-publiclink \
services/storage-shares \
Expand Down
7 changes: 6 additions & 1 deletion services/sse/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# SSE

@todo
The `sse` service is responsible for sending sse (Server-Sent Events) to a user. See [What is Server-Sent Events](https://medium.com/yemeksepeti-teknoloji/what-is-server-sent-events-sse-and-how-to-implement-it-904938bffd73) for a simple introduction and examples of server sent events..

## Subscribing

Clients can subscribe to the `/sse` endpoint to be informed by the server when an event happens. The `sse` endpoint will respect language changes of the user without needing to reconnect. Note that SSE has a limitation of six open connections per browser which can be reached if one has opened various tabs of the Web UI pointing to the same Infinite Scale instance.

2 changes: 1 addition & 1 deletion services/sse/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

// all events we care about
var _registeredEvents = []events.Unmarshaller{
events.SendUserNotification{},
events.SendSSE{},
}

// Server is the entrypoint for the server command.
Expand Down
2 changes: 1 addition & 1 deletion services/sse/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ type HTTP struct {

// TokenManager is the config for using the reva token manager
type TokenManager struct {
JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;USERLOG_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."`
JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;SSE_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."`
}
4 changes: 0 additions & 4 deletions services/userlog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ For the time being, the configuration which user related events are of interest

The `userlog` service provides an API to retrieve configured events. For now, this API is mostly following the [oc10 notification GET API](https://doc.owncloud.com/server/next/developer_manual/core/apis/ocs-notification-endpoint-v1.html#get-user-notifications).

## Subscribing

Additionally to the oc10 API, the `userlog` service also provides an `/sse` (Server-Sent Events) endpoint to be informed by the server when an event happens. See [What is Server-Sent Events](https://medium.com/yemeksepeti-teknoloji/what-is-server-sent-events-sse-and-how-to-implement-it-904938bffd73) for a simple introduction and examples of server sent events. The `sse` endpoint will respect language changes of the user without needing to reconnect. Note that SSE has a limitation of six open connections per browser which can be reached if one has opened various tabs of the Web UI pointing to the same Infinite Scale instance.

## Posting

The userlog service is able to store global messages that will be displayed in the Web UI to all users. If a user deletes the message in the Web UI, it reappears on reload. Global messages use the endpoint `/ocs/v2.php/apps/notifications/api/v1/notifications/global` and are activated by sending a `POST` request. Note that sending another `POST` request of the same type overwrites the previous one. For the time being, only the type `deprovision` is supported.
Expand Down

0 comments on commit 5226153

Please sign in to comment.