ws

package
v0.0.0-...-0de1ee4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUpgrading    = &ErrorResponse{StatusCode: http.StatusUpgradeRequired, ErrorText: "could not upgrade"}
	ErrUnauthorized = &ErrorResponse{StatusCode: http.StatusUnauthorized, ErrorText: "session not found"}
)

Functions

This section is empty.

Types

type ErrorResponse

type ErrorResponse struct {
	Err        error  `json:"-"`
	StatusCode int    `json:"-"`
	ErrorText  string `json:"error"`
}

func ErrExecute

func ErrExecute(err error) *ErrorResponse

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

func (*ErrorResponse) Render

func (*ErrorResponse) WithError

func (e *ErrorResponse) WithError(err error) *ErrorResponse

type Stream

type Stream struct {
	// contains filtered or unexported fields
}

func NewStream

func NewStream(conn *websocket.Conn) *Stream

func (*Stream) Publish

func (s *Stream) Publish(event any) error

type StreamRepository

type StreamRepository struct {
	// contains filtered or unexported fields
}

func NewStreamRepository

func NewStreamRepository() *StreamRepository

func (*StreamRepository) Add

func (r *StreamRepository) Add(id string, stream *Stream)

func (*StreamRepository) Find

func (*StreamRepository) Remove

func (r *StreamRepository) Remove(id string)

type WebSocket

type WebSocket struct {
	// contains filtered or unexported fields
}

func (*WebSocket) ServeHTTP

func (ws *WebSocket) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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