mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-12-18 16:31:06 +00:00
dbef5ee03b
Neither Semaphore nor Pinafore are under active development, but Semaphore has archived its repository while Pinafore still gets occasional minor maintenance. Enafore has newer features, but it has accessibility bugs affecting screen readers that prevent it from being recommended at this time.
1.5 KiB
1.5 KiB
WebSocket
GoToSocial 使用安全的 WebSocket 协议(即 wss
)来通过客户端应用程序(如 Pinafore)实现贴文和通知的实时更新。
为了使用此功能,你需要确保配置 GoToSocial 所在的代理允许 WebSocket 连接通过。
WebSocket 端点位于 wss://example.org/api/v1/streaming
,其中 example.org
是你的 GoToSocial 实例的域名。
WebSocket 端点使用在通用配置的 port
部分中配置的相同端口。
典型的 WebSocket 请求头,如 Pinafore 所发送的如下所示:
Host: example.org
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/99.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Sec-WebSocket-Version: 13
Origin: https://pinafore.social
Sec-WebSocket-Protocol: null
Sec-WebSocket-Extensions: permessage-deflate
Sec-WebSocket-Key: YWFhYWFhYm9vYmllcwo=
DNT: 1
Connection: keep-alive, Upgrade
Sec-Fetch-Dest: websocket
Sec-Fetch-Mode: websocket
Sec-Fetch-Site: cross-site
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
典型的 WebSocket 响应头,如 GoToSocial 返回的如下所示:
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: WVdGaFlXRmhZbTl2WW1sbGN3bz0K
无论你的设置如何,你都需要确保这些头在你的反向代理中被允许,这可能需要根据所使用的具体反向代理进行额外配置。