Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
func Initialize ¶
func (*Server) AuthorizedOrigins ¶
AuthorizedOrigins implements the CheckOrigin method of the websocket.Upgrader. This checks if the incoming request's origin is allowed to connect to the server. The server will log if the origin is permitted or rejected.
func (*Server) Handler ¶
Handler is an HTTP handler that handles WebSocket connections and relays messages.
Given an HTTP request, this function will upgrade the connection to a WebSocket connection and start a new client session. The function will then read all incoming messages, decode them, validate them, and handle them accordingly.
func (*Server) Upgrader ¶
Upgrader checks if the client requested a websocket upgrade, and if so, sets a local variable to true. If the client did not request a websocket upgrade, this middleware will return ErrUpgradeRequired. If the client is not allowed to connect, this middleware will return ErrForbidden. If the client does not provide a UGI, this middleware will return ErrBadRequest.