Documentation ¶
Index ¶
- type ClientTransport
- type ErrSockRead
- type ErrSockReadWrongMsgType
- 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 gorilla/websocket
func (*ClientTransport) NewSocket ¶
func (cltTrans *ClientTransport) NewSocket( dialTimeout time.Duration, ) (wwr.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 ErrSockReadWrongMsgType ¶
type ErrSockReadWrongMsgType struct {
// contains filtered or unexported fields
}
ErrSockReadWrongMsgType implements the ErrSockRead interface
func (ErrSockReadWrongMsgType) Error ¶
func (err ErrSockReadWrongMsgType) Error() string
Error implements the Go error interface
func (ErrSockReadWrongMsgType) IsCloseErr ¶
func (err ErrSockReadWrongMsgType) 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 gorilla/websocket library
func NewConnectedSocket ¶
NewConnectedSocket creates a new gorilla/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(resp http.ResponseWriter, req *http.Request) // 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 // wwr.Refuse to refuse the incoming connection BeforeUpgrade func( resp http.ResponseWriter, req *http.Request, ) wwr.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.Upgrader // HTTPServer specifies the net/http server HTTPServer *http.Server // TLS enables TLS encryption if specified TLS *TLS // contains filtered or unexported fields }
Transport implements the webwire transport layer with gorilla/websocket
func (*Transport) Initialize ¶
func (srv *Transport) Initialize( options wwr.ServerOptions, isShuttingdown wwr.IsShuttingDown, onNewConnection wwr.OnNewConnection, ) error
Initialize implements the Transport interface