Documentation ¶
Index ¶
- func NewClient(w http.ResponseWriter, r *http.Request) (string, error)
- func NewWebsocketServer(opts ...Option) toybox.Option
- func SendMessage(msg InputMessage)
- type Client
- type Context
- func (c *Context) Get(key string) (value any, exists bool)
- func (c *Context) GetBool(key string) (b bool)
- func (c *Context) GetDuration(key string) (d time.Duration)
- func (c *Context) GetFloat64(key string) (f64 float64)
- func (c *Context) GetInt(key string) (i int)
- func (c *Context) GetInt64(key string) (i64 int64)
- func (c *Context) GetMessage() InputMessage
- func (c *Context) GetString(key string) (s string)
- func (c *Context) GetStringMap(key string) (sm map[string]any)
- func (c *Context) GetStringMapString(key string) (sms map[string]string)
- func (c *Context) GetStringMapStringSlice(key string) (smss map[string][]string)
- func (c *Context) GetStringSlice(key string) (ss []string)
- func (c *Context) GetTime(key string) (t time.Time)
- func (c *Context) GetUint(key string) (ui uint)
- func (c *Context) GetUint64(key string) (ui64 uint64)
- func (c *Context) MustGet(key string) any
- func (c *Context) SendMessage(msg OutputMessage)
- func (c *Context) Set(key string, value any)
- type InputMessage
- type MessageHandleFunc
- type Option
- type OutputMessage
- type WebsocketServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewWebsocketServer ¶
func SendMessage ¶
func SendMessage(msg InputMessage)
Types ¶
type Context ¶
func (*Context) GetFloat64 ¶
func (*Context) GetMessage ¶
func (c *Context) GetMessage() InputMessage
func (*Context) GetStringMapString ¶
func (*Context) GetStringMapStringSlice ¶
func (*Context) GetStringSlice ¶
func (*Context) SendMessage ¶
func (c *Context) SendMessage(msg OutputMessage)
type InputMessage ¶
func NewMessage ¶
func NewMessage(id string, msg []byte) InputMessage
type MessageHandleFunc ¶
type MessageHandleFunc func(ctx *Context)
type Option ¶
type Option func(*WebsocketServer)
func WithMessageHandler ¶
func WithMessageHandler(handleFunc ...MessageHandleFunc) Option
type OutputMessage ¶
func NewOutputMessage ¶
func NewOutputMessage(body []byte, targets ...string) OutputMessage
type WebsocketServer ¶
type WebsocketServer struct { ReadBufferSize int64 `toml:"read_buffer_size"` WriteBufferSize int64 `toml:"write_buffer_size"` MaxMsgChannelSize int64 `toml:"max_msg_channel_size"` WriteWait time.Duration `toml:"write_wait"` PongWait time.Duration `toml:"pong_wait"` PingPeriod time.Duration `toml:"ping_period"` MaxMessageSize int64 `toml:"max_message_size"` // contains filtered or unexported fields }
func (*WebsocketServer) IsReady ¶
func (ws *WebsocketServer) IsReady()
func (*WebsocketServer) Name ¶
func (ws *WebsocketServer) Name() string
func (*WebsocketServer) Ready ¶
func (ws *WebsocketServer) Ready() bool
Click to show internal directories.
Click to hide internal directories.