Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var MAX_CONNECTION_RETRIES = 5
View Source
var MSG_DELIM = "\n"
View Source
var RETRY_TIMEOUT = 5 * time.Second
Functions ¶
func IsActionType ¶
Types ¶
type Action ¶
type Action struct { Type string `json:"type"` Payload interface{} `json:"payload"` Timestamp int64 `json:"timestamp"` Source string `json:"source"` SessionId string `json:"sessionId"` }
func CreateAction ¶
func CreateActionWithSource ¶
func (*Action) HasPayload ¶
type Handler ¶
type IdExchange ¶
type IdExchange struct {
ConnectionId string `json:"connectionId"`
}
type SockClient ¶
type SockClient[T any] struct { Config SockClientConfig `validate:"required"` Handler Handler[T] SendFn func(action Action) // contains filtered or unexported fields }
func (*SockClient[T]) Connect ¶
func (sc *SockClient[T]) Connect()
func (*SockClient[T]) ReadAction ¶
func (sc *SockClient[T]) ReadAction() Action
func (*SockClient[T]) Send ¶
func (sc *SockClient[T]) Send(action Action)
type SockClientConfig ¶
func (*SockClientConfig) ConnSrv ¶
func (scc *SockClientConfig) ConnSrv() string
func (*SockClientConfig) ConnUrl ¶
func (scc *SockClientConfig) ConnUrl() string
type SockServer ¶
type SockServer struct { Config SockClientConfig Connections []net.Conn }
func (*SockServer) Listen ¶
func (sc *SockServer) Listen()
type WebSocketServer ¶
type WebSocketServer struct {
// contains filtered or unexported fields
}
func NewWebSocketServer ¶
func NewWebSocketServer(config SockClientConfig) WebSocketServer
func (*WebSocketServer) Run ¶
func (wss *WebSocketServer) Run()
Click to show internal directories.
Click to hide internal directories.