util

package
v0.0.0-...-14c233f Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: Apache-2.0, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCloseFrameData

func CheckCloseFrameData(code ws.StatusCode, reason string) error

CheckCloseFrameData checks received close information to be valid RFC6455 compatible close info.

Note that code.Empty() or code.IsAppLevel() will raise error.

If endpoint sends close frame without status code (with frame.Length = 0), application should not check its payload.

func HandleClose

func HandleClose(h *ws.Header, payload []byte) ([]byte, error)

HandleClose 处理 websocket close 返回应答信息

func HandlePing

func HandlePing(payload []byte) ([]byte, error)

HandlePing 处理 ping 返回应答信息

func HandlePong

func HandlePong(payload []byte) ([]byte, error)

HandlePong 处理 pong 返回应答信息

func PackCloseData

func PackCloseData(reason string) ([]byte, error)

PackCloseData 封装 websocket close 数据包

func PackData

func PackData(messageType ws.MessageType, data []byte) ([]byte, error)

PackData 封装 websocket message 数据包

Types

This section is empty.

Jump to

Keyboard shortcuts

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