Documentation ¶
Index ¶
- func ServerOptions() *options
- type Client
- type Connection
- func (c *Connection) Close() error
- func (c *Connection) Errors() <-chan error
- func (c *Connection) GetAttribute(key string) (val string, exists bool)
- func (c *Connection) HandleRawUpdate(handler func(message []byte))
- func (c *Connection) HandleUpdate(updateType string, handler func(message json.RawMessage))
- func (c *Connection) ID() string
- func (c *Connection) InternalUpdates() <-chan []byte
- func (c *Connection) ProcessUpdates() error
- func (c *Connection) Server() *Server
- func (c *Connection) SetAttribute(key, val string)
- func (c *Connection) SetKeepAliveDuration(keepAlive time.Duration)
- func (c *Connection) SetMiddleware(middleware func(message []byte) error)
- func (c *Connection) SetOnClose(onClose func())
- func (c *Connection) SetUpdateTypeMiddleware(middleware func(updateType string, data json.RawMessage) error)
- func (c *Connection) UpgradeRequest() *http.Request
- func (c *Connection) WriteBinaryBytes(data []byte) (err error)
- func (c *Connection) WriteBinaryText(data []byte) (err error)
- func (c *Connection) WriteInternalUpdate(update []byte)
- func (c *Connection) WriteRawUpdate(data interface{}) (err error)
- func (c *Connection) WriteText(data string) (err error)
- func (c *Connection) WriteUpdate(updateType string, data interface{}) (err error)
- type Logger
- type Server
- type Update
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServerOptions ¶ added in v0.3.0
func ServerOptions() *options
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) SetOnError ¶ added in v0.3.0
func (*Client) SetRawHandler ¶ added in v0.3.0
func (*Client) SetUpdateTypeHandler ¶ added in v0.3.0
func (c *Client) SetUpdateTypeHandler(updateType string, fn func(message json.RawMessage)) *Client
type Connection ¶ added in v0.2.9
type Connection struct {
// contains filtered or unexported fields
}
func (*Connection) Close ¶ added in v0.2.9
func (c *Connection) Close() error
func (*Connection) Errors ¶ added in v0.2.9
func (c *Connection) Errors() <-chan error
func (*Connection) GetAttribute ¶ added in v0.2.9
func (c *Connection) GetAttribute(key string) (val string, exists bool)
func (*Connection) HandleRawUpdate ¶ added in v0.2.9
func (c *Connection) HandleRawUpdate(handler func(message []byte))
HandleRawUpdate registers a default handler for update Note: Add a raw handler if you don't want to follow the API convention {"type": "", "data": {}}
func (*Connection) HandleUpdate ¶ added in v0.2.9
func (c *Connection) HandleUpdate(updateType string, handler func(message json.RawMessage))
HandleUpdate registers a default handler for updateType Care: If you use this method for an updateType, you won't receive the respected update in your listener
func (*Connection) ID ¶ added in v0.2.9
func (c *Connection) ID() string
func (*Connection) InternalUpdates ¶ added in v0.2.9
func (c *Connection) InternalUpdates() <-chan []byte
func (*Connection) ProcessUpdates ¶ added in v0.2.9
func (c *Connection) ProcessUpdates() error
func (*Connection) Server ¶ added in v0.2.9
func (c *Connection) Server() *Server
func (*Connection) SetAttribute ¶ added in v0.2.9
func (c *Connection) SetAttribute(key, val string)
func (*Connection) SetKeepAliveDuration ¶ added in v0.2.9
func (c *Connection) SetKeepAliveDuration(keepAlive time.Duration)
func (*Connection) SetMiddleware ¶ added in v0.2.9
func (c *Connection) SetMiddleware(middleware func(message []byte) error)
func (*Connection) SetOnClose ¶ added in v0.2.9
func (c *Connection) SetOnClose(onClose func())
func (*Connection) SetUpdateTypeMiddleware ¶ added in v0.2.9
func (c *Connection) SetUpdateTypeMiddleware(middleware func(updateType string, data json.RawMessage) error)
func (*Connection) UpgradeRequest ¶ added in v0.2.9
func (c *Connection) UpgradeRequest() *http.Request
func (*Connection) WriteBinaryBytes ¶ added in v0.2.9
func (c *Connection) WriteBinaryBytes(data []byte) (err error)
func (*Connection) WriteBinaryText ¶ added in v0.2.9
func (c *Connection) WriteBinaryText(data []byte) (err error)
func (*Connection) WriteInternalUpdate ¶ added in v0.2.9
func (c *Connection) WriteInternalUpdate(update []byte)
func (*Connection) WriteRawUpdate ¶ added in v0.2.9
func (c *Connection) WriteRawUpdate(data interface{}) (err error)
func (*Connection) WriteText ¶ added in v0.2.9
func (c *Connection) WriteText(data string) (err error)
func (*Connection) WriteUpdate ¶ added in v0.2.9
func (c *Connection) WriteUpdate(updateType string, data interface{}) (err error)
type Server ¶ added in v0.2.9
type Server struct {
// contains filtered or unexported fields
}
func (*Server) Clients ¶ added in v0.2.9
func (s *Server) Clients() chan *Connection
type Update ¶
type Update struct { Type string `json:"type"` Data json.RawMessage `json:"data,omitempty"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.