Documentation ¶
Index ¶
Constants ¶
const GoingAwayMessage = -1
GoingAwayMessage - uses when connection was aborted.
const TextMessage = 1
TextMessage - uses when message is correct.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
func NewRequest ¶
func NewRequest(cp *ConnectionPool, cId int) *Bus
NewRequest - creator for new request.
func (*Bus) ConnectionDelete ¶
func (r *Bus) ConnectionDelete()
ConnectionDelete - delete current connection.
func (*Bus) ConnectionId ¶
ConnectionId - getter for current connection id.
func (*Bus) ConnectionPool ¶
func (r *Bus) ConnectionPool() *ConnectionPool
ConnectionPool - getter for connection pool.
func (*Bus) ConnectionPoolWriteEvent ¶
ConnectionPoolWriteEvent - write event into connection pool.
func (*Bus) ConnectionReadEvent ¶
ConnectionReadEvent - read event from current connection.
func (*Bus) ConnectionWriteEvent ¶
ConnectionWriteEvent - write event into current connection.
type ConnectionCollection ¶
type ConnectionCollection struct {
// contains filtered or unexported fields
}
ConnectionCollection - collection of client websocket connections. Represent interface of one client websocket.
func NewConnectionCollection ¶
func NewConnectionCollection(c map[int]*websocket.Conn) *ConnectionCollection
NewConnectionCollection - instantiate new connection collection.
func (*ConnectionCollection) WriteMessage ¶
func (cc *ConnectionCollection) WriteMessage(messageType int, data []byte)
WriteMessage - write same message to each connection.
type ConnectionPool ¶
type ConnectionPool struct {
// contains filtered or unexported fields
}
ConnectionPool - pool of client websocket connections.
func NewConnectionPool ¶
func NewConnectionPool() *ConnectionPool
NewConnectionPool - instantiate new connection pool.
func (*ConnectionPool) Count ¶
func (cp *ConnectionPool) Count() int
Count - count connections in pool.
func (*ConnectionPool) Delete ¶
func (cp *ConnectionPool) Delete(id int)
Delete - delete one connection in the pool.
func (*ConnectionPool) Get ¶
func (cp *ConnectionPool) Get(id int) *websocket.Conn
Get - get one connection from the pool.
func (*ConnectionPool) GetAll ¶
func (cp *ConnectionPool) GetAll() *ConnectionCollection
GetAll - get all connections from the pool.
type Event ¶
Event structure for exchange by websocket.
func DecodeMessage ¶
DecodeMessage - DecodeMessage event from message
type EventOperation ¶
type EventOperation string
type Upgrader ¶
Upgrader - custom upgrader structure.
func (*Upgrader) CheckOriginFunc ¶
CheckOriginFunc - uses for checking request origin. Can be used to identify client.
func (*Upgrader) UpgradeConnection ¶
UpgradeConnection - establish new connection.