testutil

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package testutil provides testing utilities for websocket functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertHTTPToWS

func ConvertHTTPToWS(u string) (string, error)

ConvertHTTPToWS converts an HTTP(S) URL to its WebSocket (ws:// or wss://) equivalent.

Types

type MockWebSocketServer

type MockWebSocketServer struct {
	Msgs []map[string]any
}

MockWebSocketServer is a test utility for simulating a WebSocket server and capturing sent messages.

func (*MockWebSocketServer) TestWebSocketServer

func (ms *MockWebSocketServer) TestWebSocketServer(writeFunc connFn) *httptest.Server

TestWebSocketServer starts an HTTP test server that upgrades requests to WebSocket and invokes writeFunc.

Jump to

Keyboard shortcuts

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