Documentation
¶
Index ¶
Constants ¶
View Source
const ( WebsocketReadTimeout = 30 * time.Second WebsocketWriteTimeout = 10 * time.Second )
Variables ¶
View Source
var PubSubHTTPHandlerLogger = slogutil.NewLogger("pubsub-http-handler")
Functions ¶
This section is empty.
Types ¶
type HTTPHandler ¶
type HTTPHandler struct {
RedisHub RedisHub
Delegate Delegate
OriginMatcher WebsocketOriginMatcher
}
HTTPHandler receives incoming websocket messages and delegates them to the delegate. For each websocket connection, a redis pubsub connection is established. Every message from the redis pubsub connection is forwarded to the websocket connection verbatim.
func (*HTTPHandler) ServeHTTP ¶
func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type WebsocketOriginMatcher ¶
type WebsocketOutgoingMessage ¶
type WebsocketOutgoingMessage struct {
MessageType websocket.MessageType
Data []byte
}
Click to show internal directories.
Click to hide internal directories.