Documentation ¶
Index ¶
Constants ¶
View Source
const ( //PacketTypeJSON is const of packet data type json PacketTypeJSON int = 0 //PacketTypeClass is const of packet data type class PacketTypeClass int = 1 //PacketTypeHeartbeat is const of packet data type heartbeat PacketTypeHeartbeat int = 2 //TextMessage the same as gorilla message type TextMessage int = 1 //BinaryMessage the same as gorilla message type BinaryMessage int = 2 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnData ¶
ConnData is connection object which do receive and send data using gorilla websocket conn
func NewConnData ¶
func NewConnData(co *gorillaWebsocket.Conn, connecLostChan chan string, receivePacketChan chan *ReceivePacketData, aliveTimeout time.Duration) (ConnData, error)
newConnData returns a new connData.
type ReceivePacketData ¶
ReceivePacketData contain parsed date which is read from connection Without packet head With data type and packet body
type SendPacketData ¶
type SendPacketData struct {
// contains filtered or unexported fields
}
SendPacketData store receiveIDs and packet to send
type WebsocketService ¶
type WebsocketService interface { Start() error Stop() error Destroy() Send(receiverIDs []string, sentPacket []byte) error Disconnect(id string) error GetReceivePacketChan() <-chan *ReceivePacketData GetLostConnIDChan() <-chan string }
Service this is a socket manager used for followings purpose: Hold connection Read packet Write packet Send packet to chan
Click to show internal directories.
Click to hide internal directories.