Documentation
¶
Index ¶
- Constants
- func CreateNatsClient(ctx context.Context) (*nats.Conn, error)
- func EncodeMessage(nc *nats.Conn, msg *Message) ([]byte, error)
- func NewNatsLogger(config Config) natsd.Logger
- func PublishBinary(nc *nats.Conn, topic string, data []byte) error
- func PublishText(nc *nats.Conn, topic string, data []byte) error
- func WrapAccessLog(next http.Handler, logger HttpLogger) http.Handler
- type Config
- type DefLogger
- type HttpController
- func (c *HttpController) CheckStatus(res http.ResponseWriter, req *http.Request)
- func (c *HttpController) HttpHandler() http.Handler
- func (c *HttpController) TopicPublish(res http.ResponseWriter, req *http.Request)
- func (c *HttpController) TopicSubscribe(res http.ResponseWriter, req *http.Request)
- func (c *HttpController) TopicSubscribeWithQueue(res http.ResponseWriter, req *http.Request)
- func (c *HttpController) Version(res http.ResponseWriter, req *http.Request)
- type HttpLogger
- type HttpServer
- type Message
- type MultiLogger
- type NatsLogger
- func (n *NatsLogger) Debugf(format string, v ...interface{})
- func (n *NatsLogger) Errorf(format string, v ...interface{})
- func (n *NatsLogger) Fatalf(format string, v ...interface{})
- func (n *NatsLogger) Noticef(format string, v ...interface{})
- func (n *NatsLogger) Tracef(format string, v ...interface{})
- func (n *NatsLogger) Warnf(format string, v ...interface{})
- type SendQueue
- type SubQueue
- type WebsocketHandler
- type WrapWriter
Constants ¶
View Source
const ( DEFAULT_LOG_DIR string = "/tmp" DEFAULT_BIND_IP string = "0.0.0.0" DEFAULT_BIND_PORT int = 8080 DEFAULT_MSG_MAX_PAYLOAD int = 1024 * 1024 DEFAULT_PING_INTERVAL int = 1000 DEFAULT_PING_OUT int = 5 DEFAULT_WS_MAX_MESSAGE_SIZE int = 1024 * 1024 )
View Source
const ( AppName string = "nats-wsmsg" Version string = "1.3.0" UA string = AppName + "/" + Version )
View Source
const TAB string = "\t"
Variables ¶
This section is empty.
Functions ¶
func NewNatsLogger ¶
func WrapAccessLog ¶
func WrapAccessLog(next http.Handler, logger HttpLogger) http.Handler
Types ¶
type HttpController ¶
type HttpController struct {
// contains filtered or unexported fields
}
func NewHttpController ¶
func NewHttpController(ctx context.Context) *HttpController
func (*HttpController) CheckStatus ¶
func (c *HttpController) CheckStatus(res http.ResponseWriter, req *http.Request)
func (*HttpController) HttpHandler ¶
func (c *HttpController) HttpHandler() http.Handler
func (*HttpController) TopicPublish ¶
func (c *HttpController) TopicPublish(res http.ResponseWriter, req *http.Request)
func (*HttpController) TopicSubscribe ¶
func (c *HttpController) TopicSubscribe(res http.ResponseWriter, req *http.Request)
func (*HttpController) TopicSubscribeWithQueue ¶
func (c *HttpController) TopicSubscribeWithQueue(res http.ResponseWriter, req *http.Request)
func (*HttpController) Version ¶
func (c *HttpController) Version(res http.ResponseWriter, req *http.Request)
type HttpLogger ¶
func NewHttpLogger ¶
func NewHttpLogger(config Config) HttpLogger
type HttpServer ¶
type HttpServer struct {
Server *http.Server
Controller *HttpController
// contains filtered or unexported fields
}
func NewHttpServer ¶
func NewHttpServer(ctx context.Context) *HttpServer
type MultiLogger ¶
type MultiLogger struct {
// contains filtered or unexported fields
}
type NatsLogger ¶
type NatsLogger struct {
// contains filtered or unexported fields
}
func (*NatsLogger) Debugf ¶
func (n *NatsLogger) Debugf(format string, v ...interface{})
func (*NatsLogger) Errorf ¶
func (n *NatsLogger) Errorf(format string, v ...interface{})
func (*NatsLogger) Fatalf ¶
func (n *NatsLogger) Fatalf(format string, v ...interface{})
func (*NatsLogger) Noticef ¶
func (n *NatsLogger) Noticef(format string, v ...interface{})
func (*NatsLogger) Tracef ¶
func (n *NatsLogger) Tracef(format string, v ...interface{})
func (*NatsLogger) Warnf ¶
func (n *NatsLogger) Warnf(format string, v ...interface{})
type WebsocketHandler ¶
type WebsocketHandler struct {
// contains filtered or unexported fields
}
func CreateWebsocketHandler ¶
func CreateWebsocketHandler(ctx context.Context, res http.ResponseWriter, req *http.Request) (*WebsocketHandler, error)
func (*WebsocketHandler) Close ¶
func (ws *WebsocketHandler) Close() error
func (*WebsocketHandler) RunSubscribe ¶
func (ws *WebsocketHandler) RunSubscribe(topic string) error
func (*WebsocketHandler) RunSubscribeWithGroup ¶
func (ws *WebsocketHandler) RunSubscribeWithGroup(topic, group string) error
type WrapWriter ¶
type WrapWriter struct {
Writer http.ResponseWriter
LastStatus int
}
func (*WrapWriter) Header ¶
func (w *WrapWriter) Header() http.Header
func (*WrapWriter) Hijack ¶
func (w *WrapWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
allow hijack
func (*WrapWriter) WriteHeader ¶
func (w *WrapWriter) WriteHeader(status int)
Click to show internal directories.
Click to hide internal directories.

