Documentation ¶
Index ¶
Constants ¶
View Source
const ( TextMessage = websocket.TextMessage BinaryMessage = websocket.BinaryMessage CloseMessage = websocket.CloseMessage PingMessage = websocket.PingMessage PongMessage = websocket.PongMessage )
The message types are defined in RFC 6455, section 11.8.
View Source
const (
RequestHeaders = "x-http-req-headers"
)
Variables ¶
View Source
var (
ErrEventNotSupported = errors.New("this event type is not supported")
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a websocket client, basically a frontend visitor
func NewClient ¶
func NewClient(ctx context.Context, log logger.Logger, conn *websocket.Conn, manager *Manager) *Client
NewClient is used to initialize a new Client with all required values initialized
type ClientList ¶
type Event ¶
type Event struct { Type string `json:"type"` Payload json.RawMessage `json:"payload"` }
type Manager ¶
Manager is used to hold references to all Clients Registered, and Broadcasting etc
func NewManager ¶
NewManager is used to initialize all the values inside the manager
func (*Manager) AddEventHandler ¶
func (m *Manager) AddEventHandler(event string, handler EventHandler)
AddEventHandler configures and adds all handlers
Click to show internal directories.
Click to hide internal directories.