websocket

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package websocket is responsible for handling WebSocket connections.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsWebSocket

func IsWebSocket(u *url.URL) (ok bool)

IsWebSocket returns true if the request is to WebSocket.

func IsWebSocketResponse

func IsWebSocketResponse(resp *http.Response) (ok bool)

IsWebSocketResponse checks if the response is a valid 101 Switching Protocols response and the following data should follow the WebSocket protocol.

func NewWebSocket

func NewWebSocket(conn net.Conn, out *output.Output) (rwc io.ReadWriteCloser)

NewWebSocket returns an io.ReadWriterCloser that can be used to send and receive data to/from a websocket.

func UpgradeWebSocket

func UpgradeWebSocket(r *http.Request) (upgradeReq *http.Request)

UpgradeWebSocket checks if the request r is a WebSocket requests and adds Upgrade header if needed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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