Documentation ¶
Index ¶
- Constants
- func HandleIdentityMessage(payload common.IdentityMessage, client *Client, message common.Message) error
- func HandleLogMessage(message common.LogMessage, client *Client)
- func HandleMessage(client *Client, message common.Message) (common.Message, error)
- func InitHttpServer()
- func Main()
- func SubscriberView(context *gin.Context)
- func WebsocketHandler(r *http.Request, w http.ResponseWriter)
- type Client
- type Hub
- type ServerOptions
Constants ¶
View Source
const ( WRITE_WAIT = 10 * time.Second PONG_WAIT = 60 * time.Second PING_PERIOD = (PONG_WAIT * 9) / 10 EVENT_IDENTITY = "identity" EVENT_LOG_LINE = "log_line" EVENT_SUBSCRIBER_ACK = "subscriber_ack" )
View Source
const ( DEFAULT_ENVIRONMENT = "prod" DEFAULT_DOMAIN = "localhost:3000" DEFAULT_PORT = "3000" DEFAULT_LOG_LEVEL = "warn" DEFAULT_READ_BUFFER_SIZE = "0" DEFAULT_WRITE_BUFFER_SIZE = "0" DEFAULT_MAX_MESSAGE_SIZE = "1024" )
View Source
const (
HTML_MAIN_INDEX = "index.html"
)
Variables ¶
This section is empty.
Functions ¶
func HandleIdentityMessage ¶ added in v0.1.4
func HandleLogMessage ¶ added in v0.1.4
func HandleLogMessage(message common.LogMessage, client *Client)
func HandleMessage ¶
func InitHttpServer ¶
func InitHttpServer()
func SubscriberView ¶
func WebsocketHandler ¶
func WebsocketHandler(r *http.Request, w http.ResponseWriter)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) IsActiveBroadcaster ¶
func (*Client) IsActiveSubscriber ¶
func (*Client) ReadIncomingMessage ¶
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Maintain the set of active clients
func (*Hub) RemoveActiveSubscribers ¶
func (*Hub) RemoveClient ¶
removeChannel is a flag must be set to true to remove client send channel This flag is added to avoid removing client channel when updating the client
type ServerOptions ¶
type ServerOptions struct { Env string Domain *common.Domain Port int LogLevel zapcore.Level ReadBufferSize int WriteBufferSize int MaxMessageSize int64 }
func InitOptions ¶
func InitOptions() *ServerOptions
Click to show internal directories.
Click to hide internal directories.