Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conn ¶
type Conn interface { // ReadJson reads the current input. ReadJSON(p interface{}) error // WriteJson writes back to the client. WriteJSON(p interface{}) error // RemoteAddr returns the remote address of the client. RemoteAddr() net.Addr // Close closes the connection with the client. Close() error }
Conn is the type which represent an connection with the client. grpc.Conn is an example of implementation.
type Status ¶ added in v0.1.1
type Status string
var StatusError Status = "error"
var StatusOK Status = "ok"
type StatusBody ¶ added in v0.1.1
type Store ¶
Store stores the map between connections and its job keys.
func (Store) GetWebsocket ¶
GetWebsocket provides the websocket associated with the provided job key
func (Store) Register ¶
RegisterWebsocket adds a new websocket in the store. It initialize its job key slice.
func (Store) Unregister ¶
UnregisterWebsocket removes a registered websocket from the store and removes all its job keys
type Websocket ¶
type Websocket interface { // Upgrade creates a new connection from the current HTTP context. Upgrade(w http.ResponseWriter, r *http.Request, h http.Header) (Conn, error) // IsClosed checks if the given error is related to a connection closure. IsClosed(err error) bool }
Websocket is responsible for creating new websocket connections.
func NewWebsocket ¶
func NewWebsocket(opt WebsocketOptions) (Websocket, error)
type WebsocketOptions ¶
type WebsocketOptions struct {
Origins []string
}
Click to show internal directories.
Click to hide internal directories.