sockjs

package
v0.0.0-...-eca9d05 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2018 License: MIT, GPL-2.0 Imports: 14 Imported by: 0

README

sockjs-go-client

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Connection Connection

	WebSockets   bool
	Address      string
	ReadBufSize  int
	WriteBufSize int

	Reconnected chan struct{}
}

func NewClient

func NewClient(address string) (*Client, error)

func (*Client) Info

func (c *Client) Info() (*Info, error)

func (*Client) ReadMessage

func (c *Client) ReadMessage(p interface{}) error

func (*Client) WriteMessage

func (c *Client) WriteMessage(p interface{}) error

type Connection

type Connection interface {
	ReadJSON(interface{}) error
	WriteJSON(interface{}) error
	Close() error
}

type Info

type Info struct {
	WebSocket    bool     `json:"websocket"`
	CookieNeeded bool     `json:"cookie_needed"`
	Origins      []string `json:"origins"`
	Entropy      int      `json:"entropy"`
}

type WebSocket

type WebSocket struct {
	sync.Mutex
	Address          string
	TransportAddress string
	ServerID         string
	SessionID        string
	Connection       *websocket.Conn
	Inbound          chan []byte
	Reconnected      chan struct{}
}

func NewWebSocket

func NewWebSocket(address string) (*WebSocket, error)

func (*WebSocket) Close

func (w *WebSocket) Close() error

func (*WebSocket) Loop

func (w *WebSocket) Loop()

func (*WebSocket) ReadJSON

func (w *WebSocket) ReadJSON(v interface{}) error

func (*WebSocket) WriteJSON

func (w *WebSocket) WriteJSON(v interface{}) error

type XHR

type XHR struct {
	Address          string
	TransportAddress string
	ServerID         string
	SessionID        string
	Inbound          chan []byte
}

func NewXHR

func NewXHR(address string) (*XHR, error)

func (*XHR) Close

func (x *XHR) Close() error

func (*XHR) Init

func (x *XHR) Init() error

func (*XHR) ReadJSON

func (x *XHR) ReadJSON(v interface{}) error

func (*XHR) StartReading

func (x *XHR) StartReading()

func (*XHR) WriteJSON

func (x *XHR) WriteJSON(v interface{}) error

Jump to

Keyboard shortcuts

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