transports

package
v0.0.0-...-8cd68d5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PacketToBytes

func PacketToBytes(from *Packet) (to []byte)

Types

type Client

type Client struct {
	Conn *websocket.Conn

	Event chan *Event
	// contains filtered or unexported fields
}

Client ...

func NewWebSocket

func NewWebSocket(conn *websocket.Conn) *Client

NewWebSocket ...

func (*Client) Close

func (c *Client) Close() error

Close ...

func (*Client) GetSID

func (c *Client) GetSID() string

GetSID ...

func (*Client) SendMessage

func (c *Client) SendMessage(data []byte)

SendMessage ...

func (*Client) SendPacket

func (c *Client) SendPacket(packet *Packet)

SendPacket ...

type Event

type Event struct {
	Type string
	Data []byte
}

Event ...

type Packet

type Packet struct {
	Type PacketType
	Data []byte
}

func BytesToPacket

func BytesToPacket(from []byte) (to *Packet)

func NewClosePacket

func NewClosePacket() *Packet

func NewEmptyPacket

func NewEmptyPacket(pType PacketType) *Packet

func NewErrorPacket

func NewErrorPacket(err error) *Packet

func NewPacket

func NewPacket(pType PacketType, content []byte) *Packet

type PacketType

type PacketType byte
const (
	Open    PacketType = '0'
	Close   PacketType = '1'
	Ping    PacketType = '2'
	Pong    PacketType = '3'
	Message PacketType = '4'
	Upgrade PacketType = '5'
	Noop    PacketType = '6'
	Error   PacketType = '7'
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL