Documentation
¶
Index ¶
- type ClientTransport
- type ErrSockRead
- type SockReadWrongMsgTypeErr
- type Socket
- func (sock *Socket) Close() error
- func (sock *Socket) Dial(deadline time.Time) (err error)
- func (sock *Socket) GetWriter() (io.WriteCloser, error)
- func (sock *Socket) IsConnected() bool
- func (sock *Socket) Read(msg *message.Message, deadline time.Time) webwire.ErrSockRead
- func (sock *Socket) RemoteAddr() net.Addr
- type TLS
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientTransport ¶
type ClientTransport struct {
// ServerAddress specifies the server address URL
ServerAddress url.URL
// Upgrader specifies the websocket connection upgrader
Dialer websocket.Dialer
}
ClientTransport implements the webwire client transport layer with fasthttp
func (*ClientTransport) NewSocket ¶
func (cltTrans *ClientTransport) NewSocket( dialTimeout time.Duration, ) (webwire.ClientSocket, error)
NewSocket implements the ClientTransport interface
type ErrSockRead ¶
type ErrSockRead struct {
// contains filtered or unexported fields
}
ErrSockRead implements the webwire.ErrSockRead interface
func (ErrSockRead) Error ¶
func (err ErrSockRead) Error() string
Error implements the Go error interface
func (ErrSockRead) IsCloseErr ¶
func (err ErrSockRead) IsCloseErr() bool
IsCloseErr implements the ErrSockRead interface
type SockReadWrongMsgTypeErr ¶
type SockReadWrongMsgTypeErr struct {
// contains filtered or unexported fields
}
SockReadWrongMsgTypeErr implements the ErrSockRead interface
func (SockReadWrongMsgTypeErr) Error ¶
func (err SockReadWrongMsgTypeErr) Error() string
Error implements the Go error interface
func (SockReadWrongMsgTypeErr) IsCloseErr ¶
func (err SockReadWrongMsgTypeErr) IsCloseErr() bool
IsCloseErr implements the ErrSockRead interface
type Socket ¶
type Socket struct {
// contains filtered or unexported fields
}
Socket implements the webwire.Socket interface using the fasthttp/websocket library
func NewConnectedSocket ¶
NewConnectedSocket creates a new fasthttp/websocket based socket instance
func (*Socket) GetWriter ¶
func (sock *Socket) GetWriter() (io.WriteCloser, error)
GetWriter implements the webwire.Socket interface
func (*Socket) IsConnected ¶
IsConnected implements the webwire.Socket interface
func (*Socket) RemoteAddr ¶
RemoteAddr implements the webwire.Socket interface
type Transport ¶
type Transport struct {
// Host defines the address of the host
Host string
// OnOptions is invoked when the websocket endpoint is examined by the
// client using the HTTP OPTION method.
OnOptions func(*fasthttp.RequestCtx)
// BeforeUpgrade is invoked right before the upgrade of the connection of an
// incoming HTTP request to a WebSocket connection and can be used to
// intercept, configure or prevent incoming connections. BeforeUpgrade must
// return the connection options to be applied or set options.Connection to
// webwire.Refuse to refuse the incoming connection
BeforeUpgrade func(ctx *fasthttp.RequestCtx) webwire.ConnectionOptions
// WarnLog defines the warn logging output target
WarnLog *log.Logger
// ErrorLog defines the error logging output target
ErrorLog *log.Logger
// KeepAlive enables the keep-alive option if set to a duration above -1.
// KeepAlive is automatically set to 30 seconds when it's set to 0
KeepAlive time.Duration
// Upgrader specifies the websocket connection upgrader
Upgrader *websocket.FastHTTPUpgrader
// HTTPServer specifies the FastHTTP server
HTTPServer *fasthttp.Server
// TLS enables TLS encryption if specified
TLS *TLS
// contains filtered or unexported fields
}
Transport implements the webwire transport layer with fasthttp
func (*Transport) Initialize ¶
func (srv *Transport) Initialize( options wwr.ServerOptions, isShuttingdown wwr.IsShuttingDown, onNewConnection wwr.OnNewConnection, ) error
Initialize implements the Transport interface