websocket

package
v0.0.0-...-e6d4561 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurryWsMockUpgrader

func CurryWsMockUpgrader(tb testing.TB, wsHandler WsMockFunc) http.HandlerFunc

CurryWsMockUpgrader curries a WsMockUpgrader with a testing.TB and a mock func bridging the gap between information known before the Server is created and during a request

func EchoHandler

func EchoHandler(_ testing.TB, p []byte, c *websocket.Conn) error

EchoHandler is a simple echo function after a read, this doesn't need to worry if writing to the connection fails

func WsMockUpgrader

func WsMockUpgrader(tb testing.TB, w http.ResponseWriter, r *http.Request, wsHandler WsMockFunc)

WsMockUpgrader handles upgrading an initial HTTP request to WS, and then runs a for loop calling the mock func on each input

Types

type WsMockFunc

type WsMockFunc func(testing.TB, []byte, *websocket.Conn) error

WsMockFunc is a websocket handler to be called with each websocket message

Jump to

Keyboard shortcuts

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