Documentation
¶
Index ¶
- Constants
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) IncomingHandshake(handshakeCallback grav.HandshakeCallback) error
- func (c *Conn) OutgoingHandshake(handshake *grav.TransportHandshake) (*grav.TransportHandshakeAck, error)
- func (c *Conn) ReadMsg() (grav.Message, *grav.Withdraw, error)
- func (c *Conn) SendMsg(msg grav.Message) error
- func (c *Conn) SendWithdraw(withdraw *grav.Withdraw) error
- func (c *Conn) WriteMessage(messageType int, data []byte) error
- type Transport
Constants ¶
const (
MsgTypeWebsocketMessage = "websocket.message"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn implements transport.Connection and represents a websocket connection
func (*Conn) IncomingHandshake ¶ added in v0.5.2
func (c *Conn) IncomingHandshake(handshakeCallback grav.HandshakeCallback) error
IncomingHandshake performs a connection handshake and returns the UUID of the node that we're connected to so that it can be validated against the UUID that was provided in discovery (or if none was provided)
func (*Conn) OutgoingHandshake ¶ added in v0.5.2
func (c *Conn) OutgoingHandshake(handshake *grav.TransportHandshake) (*grav.TransportHandshakeAck, error)
OutgoingHandshake performs a connection handshake and returns the UUID of the node that we're connected to so that it can be validated against the UUID that was provided in discovery (or if none was provided)
func (*Conn) SendWithdraw ¶ added in v0.5.2
SendWithdraw sends a withdraw message to the peer
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport is a transport that connects Grav nodes via standard websockets
func (*Transport) Connect ¶ added in v0.5.2
func (t *Transport) Connect(endpoint string) (grav.Connection, error)
Connect adds a websocket endpoint to emit messages to
func (*Transport) HTTPHandlerFunc ¶
func (t *Transport) HTTPHandlerFunc() http.HandlerFunc
HTTPHandlerFunc returns an http.HandlerFunc for incoming connections
func (*Transport) Setup ¶
func (t *Transport) Setup(opts *grav.MeshOptions, connFunc grav.ConnectFunc) error
Setup sets up the transport