diff options
author | 2023-07-04 12:55:10 +0200 | |
---|---|---|
committer | 2023-07-04 12:55:10 +0200 | |
commit | 3d169621735bb8dc30ec79a3ee9046d15823e626 (patch) | |
tree | 158e74ae2ac3087a14ca74c9dd7862a4231da3b7 /internal/api/client/streaming/streaming.go | |
parent | [feature] Add instance stats to /about (#1936) (diff) | |
download | gotosocial-3d169621735bb8dc30ec79a3ee9046d15823e626.tar.xz |
[chore/bugfix] Break Websockets logic into smaller read/write functions, don't log expected errors (#1932)
* [chore/bugfix] Break Websockets logic into smaller read/write functions, don't log expected errors
* tweak
* tidy up, use control message
Diffstat (limited to 'internal/api/client/streaming/streaming.go')
-rw-r--r-- | internal/api/client/streaming/streaming.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/internal/api/client/streaming/streaming.go b/internal/api/client/streaming/streaming.go index edddeab73..303e16cd3 100644 --- a/internal/api/client/streaming/streaming.go +++ b/internal/api/client/streaming/streaming.go @@ -42,15 +42,18 @@ type Module struct { } func New(processor *processing.Processor, dTicker time.Duration, wsBuf int) *Module { + // We expect CORS requests for websockets, + // (via eg., semaphore.social) so be lenient. + // TODO: make this customizable? + checkOrigin := func(r *http.Request) bool { return true } + return &Module{ processor: processor, dTicker: dTicker, wsUpgrade: websocket.Upgrader{ - ReadBufferSize: wsBuf, // we don't expect reads + ReadBufferSize: wsBuf, WriteBufferSize: wsBuf, - - // we expect cors requests (via eg., semaphore.social) so be lenient - CheckOrigin: func(r *http.Request) bool { return true }, + CheckOrigin: checkOrigin, }, } } |