Documentation
¶
Index ¶
- Variables
- func DecodeMsg(codec sabuhp.Codec, data []byte) (*sabuhp.Message, error)
- func EncodedMsg(codec sabuhp.Codec, topic string, message string, fromAddr string) ([]byte, error)
- func GetWSMessage(t *testing.T, ws *websocket.Conn) ([]byte, error)
- func HttpToWS(t *testing.T, u string) string
- func Msg(topic string, message string, fromAddr string) sabuhp.Message
- func NewTestConn(r io.Reader, w io.Writer, isServer bool) *websocket.Conn
- func NewWSServer(t *testing.T, h http.Handler) (*httptest.Server, *websocket.Conn)
- func NewWSServerOnly(t *testing.T, h http.Handler) (*httptest.Server, string)
- func ReceiveMsg(t *testing.T, ws *websocket.Conn, codec sabuhp.Codec) (*sabuhp.Message, error)
- func ReceiveWSMessage(t *testing.T, ws *websocket.Conn) []byte
- func SendMessage(t *testing.T, ws *websocket.Conn, msg []byte)
- type FakeAddr
- type FakeNetConn
- type LoggerPub
- type NetError
- type NoPubSub
- type NoPubSubChannel
- type TransportImpl
- func (t TransportImpl) Conn() sabuhp.Conn
- func (t TransportImpl) Listen(topic string, handler sabuhp.TransportResponse) sabuhp.Channel
- func (t TransportImpl) SendToAll(data *sabuhp.Message, timeout time.Duration) error
- func (t TransportImpl) SendToOne(data *sabuhp.Message, timeout time.Duration) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( LocalAddr = FakeAddr(1) RemoteAddr = FakeAddr(2) )
View Source
var (
ErrWriteTimeout = &NetError{msg: "websocket: write timeout", timeout: true, temporary: true}
)
Functions ¶
func EncodedMsg ¶
func NewTestConn ¶
NewTestConn creates a connection backed by a fake network connection using default values for buffering.
func NewWSServer ¶
func NewWSServerOnly ¶
NewWSServerOnly returns websocket http server and url for connecting.
func ReceiveMsg ¶
Types ¶
type FakeNetConn ¶
func (FakeNetConn) Close ¶
func (c FakeNetConn) Close() error
func (FakeNetConn) LocalAddr ¶
func (c FakeNetConn) LocalAddr() net.Addr
func (FakeNetConn) RemoteAddr ¶
func (c FakeNetConn) RemoteAddr() net.Addr
func (FakeNetConn) SetDeadline ¶
func (c FakeNetConn) SetDeadline(t time.Time) error
func (FakeNetConn) SetReadDeadline ¶
func (c FakeNetConn) SetReadDeadline(t time.Time) error
func (FakeNetConn) SetWriteDeadline ¶
func (c FakeNetConn) SetWriteDeadline(t time.Time) error
type NetError ¶
type NetError struct {
// contains filtered or unexported fields
}
NetError satisfies the net Error interface.
type NoPubSub ¶
type NoPubSub struct { DelegateFunc func(message *sabuhp.Message, timeout time.Duration) error BroadcastFunc func(message *sabuhp.Message, timeout time.Duration) error ChannelFunc func(topic string, callback sabuhp.TransportResponse) sabuhp.Channel }
type NoPubSubChannel ¶
type NoPubSubChannel struct {
Error error
}
func (NoPubSubChannel) Close ¶
func (n NoPubSubChannel) Close()
func (NoPubSubChannel) Err ¶
func (n NoPubSubChannel) Err() error
type TransportImpl ¶
type TransportImpl struct { ConnFunc func() sabuhp.Conn SendToOneFunc func(data *sabuhp.Message, timeout time.Duration) error SendToAllFunc func(data *sabuhp.Message, timeout time.Duration) error ListenFunc func(topic string, handler sabuhp.TransportResponse) sabuhp.Channel }
func (TransportImpl) Conn ¶
func (t TransportImpl) Conn() sabuhp.Conn
func (TransportImpl) Listen ¶
func (t TransportImpl) Listen(topic string, handler sabuhp.TransportResponse) sabuhp.Channel
Click to show internal directories.
Click to hide internal directories.