Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Addr ¶
type Addr interface { Network() string // name of the network (for example, "tcp", "ws", "wss") String() string // string form of address (for example, "192.0.2.1:25", "domain.name:80") }
Addr represents a network end point address Copy form std package net to avoid import context and fmt (gopherjs)
type Client ¶
type Client interface { // Dial creates connect to the address // secureType is a secure connection type // 0 - TLS secure with validate certificate | WSS // 1 - Secure connection but without validate certificate | Just WS // 2 - Insecure without TLS | Just WS Dial(secureType int) (Conn, error) // EncodeToProto encodes proto msg to bytes EncodeToProto(msg interface{}) ([]byte, error) // DecodeFromProto decodes proto msg from bytes DecodeFromProto(data []byte, dst interface{}) error // DecodeRoutes decodes response to _getRoutes request // returns Call methods and Notifications DecodeRoutes(data []byte) ([]Route, []Route, error) }
Client is a dialer to server from client side and proto converter
type Conn ¶
type Conn interface { // ReadMsg reads message from connect ReadMsg() ([]byte, error) // WriteMsg wtites message to connect WriteMsg([]byte) error // RemoteAddr returns the remote network address RemoteAddr() Addr // LocalAddr returns the local network address. LocalAddr() Addr // SetReadDeadline sets the deadline for future Read calls // and any currently-blocked Read call. // A zero value for t means Read will not time out. SetReadDeadline(time.Time) error // SetWriteDeadline sets the deadline for future Write calls // and any currently-blocked Write call. // Even if write times out, it may return n > 0, indicating that // some of the data was successfully written. // A zero value for t means Write will not time out. SetWriteDeadline(time.Time) error // Close closes the connection. // Any blocked Read or Write operations will be unblocked and return errors. Close() error }
Conn like net.Conn for WS or TCP connects on Server side You need to add ReadMsg and WriteMsg to net.Conn interface
Click to show internal directories.
Click to hide internal directories.