mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[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
This commit is contained in:
@ -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,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user