wrap

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WebSocketAcceptOptions = websocket.AcceptOptions{}

WebSocketAcceptOptions are the default options applied to WebSocket. You may want to set InsecureSkipVerify if you are being lazy/don't care about hosts.

Functions

func Http

func Http(fn HttpFunc) http.HandlerFunc

Http returns a http.HandlerFunc that wraps a HttpFunc capable of convenient return types.

func WebSocket

func WebSocket(fn WebSocketFunc) http.HandlerFunc

WebSocket returns a http.HandlerFunc that wraps a websocket setup/teardown.

Types

type HttpFunc

type HttpFunc func(http.ResponseWriter, *http.Request) interface{}

HttpFunc is a handler used by Http which allows generating simple result types.

type WebSocketFunc

type WebSocketFunc func(context.Context, *websocket.Conn) error

WebSocketFunc is a handler used in WebSocket.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL