Documentation
¶
Index ¶
- Constants
- func NewClientSocket(conn net.Conn, token string, tokenExp time.Time, srv EventServer) socket.ClientSocketer
- type AddEventProto
- type Event
- type EventServer
- type Event_Controller
- type Event_Controller_publish
- type Event_Controller_subscribe
- type Event_Controller_unsubscribe
- type Event_argv
- type Event_subscr
- type Event_subscr_argv
- type EvntSocket
- type EvntSrv
- func (s *EvntSrv) AddDbListener(dbEventID string, socket *EvntSocket)
- func (s *EvntSrv) CloseSocket(socket *EvntSocket)
- func (s *EvntSrv) OnNotification(_ *pgconn.PgConn, n *pgconn.Notification)
- func (s *EvntSrv) PublishEvent(evId, params string)
- func (s *EvntSrv) RemoveDbListener(dbEventID string, socket *EvntSocket)
- func (s *EvntSrv) Run()
- func (s *EvntSrv) Shutdown(ctx context.Context) error
- type OnEventProto
- type RemoveEventProto
- type UniqEvents
Constants ¶
View Source
const ( CMD_PUBLISH_ARGS = `{"argv":{"id":"%s"%s}}` CMD_PUBLISH_FN = "Event.publish" QUERY_PAUSE_MS = 50 EVNT_PARAM_EMITTER_ID = "emitterId" EVNT_MODEL_ID = "Event" )
Variables ¶
This section is empty.
Functions ¶
func NewClientSocket ¶
func NewClientSocket(conn net.Conn, token string, tokenExp time.Time, srv EventServer) socket.ClientSocketer
id string, ID: id,
Types ¶
type AddEventProto ¶
type Event ¶
type Event struct {
Id string `json:"id" required:"true" length:100`
Params map[string]interface{} `json:"params"`
}
Common structure for subscribe/unsubscribe fields.ValAssocArray
type EventServer ¶
type EventServer interface {
CloseSocket(*EvntSocket)
}
type Event_Controller ¶
type Event_Controller struct {
gobizap.Base_Controller
EvntServer *EvntSrv
}
Controller
func NewController_Event ¶
func NewController_Event() *Event_Controller
type Event_Controller_publish ¶
type Event_Controller_publish struct {
gobizap.Base_PublicMethod
}
************************************************************************************** Public method: publish
func (*Event_Controller_publish) Run ¶
func (pm *Event_Controller_publish) Run(app gobizap.Applicationer, serv srv.Server, sock socket.ClientSocketer, resp *response.Response, rfltArgs reflect.Value) error
custom method
type Event_Controller_subscribe ¶
type Event_Controller_subscribe struct {
gobizap.Base_PublicMethod
Contr *Event_Controller
}
************************************************************************************** Public method: subscribe
func (*Event_Controller_subscribe) Run ¶
func (pm *Event_Controller_subscribe) Run(app gobizap.Applicationer, serv srv.Server, sock socket.ClientSocketer, resp *response.Response, rfltArgs reflect.Value) error
custom method
type Event_Controller_unsubscribe ¶
type Event_Controller_unsubscribe struct {
gobizap.Base_PublicMethod
Contr *Event_Controller
}
************************************************************************************** Public method: unsubscribe
func (*Event_Controller_unsubscribe) Run ¶
func (pm *Event_Controller_unsubscribe) Run(app gobizap.Applicationer, serv srv.Server, sock socket.ClientSocketer, resp *response.Response, rfltArgs reflect.Value) error
custom method
type Event_argv ¶
type Event_argv struct {
Argv *Event `json:"argv"`
}
type Event_subscr ¶
type Event_subscr struct {
Events []Event `json:"events" required:"true"`
}
subscribe fields.ValArray
type Event_subscr_argv ¶
type Event_subscr_argv struct {
Argv *Event_subscr `json:"argv"`
}
type EvntSocket ¶
type EvntSocket struct {
socket.ClientSocket
Events *uniqSocketEvents //unique events for one client connection
Srv EventServer
}
Socket for one client events
func (*EvntSocket) Close ¶
func (s *EvntSocket) Close()
func (EvntSocket) GetDescr ¶
func (s EvntSocket) GetDescr() string
type EvntSrv ¶
type EvntSrv struct {
DbPool *pgxpool.Pool //
DbQuery chan string //for notification queries
Events *UniqEvents //count of unique events for db
Logger logger.Logger
LocalEvents map[string]bool
QueryPauseMS int
ReconnectParams waitStrat.WaitStrategy
OnEvent OnEventProto
// contains filtered or unexported fields
}
event server params
func NewEvntSrv ¶
func NewEvntSrv(logger logger.Logger, onEvent OnEventProto, localEvents []string) *EvntSrv
func (*EvntSrv) AddDbListener ¶
func (s *EvntSrv) AddDbListener(dbEventID string, socket *EvntSocket)
adds listener
func (*EvntSrv) CloseSocket ¶
func (s *EvntSrv) CloseSocket(socket *EvntSocket)
func (*EvntSrv) OnNotification ¶
func (s *EvntSrv) OnNotification(_ *pgconn.PgConn, n *pgconn.Notification)
func (*EvntSrv) PublishEvent ¶
calls Event.Publish(args) params - comma separated string of json params
func (*EvntSrv) RemoveDbListener ¶
func (s *EvntSrv) RemoveDbListener(dbEventID string, socket *EvntSocket)
removes listener
type OnEventProto ¶
type RemoveEventProto ¶
type UniqEvents ¶
type UniqEvents struct {
// contains filtered or unexported fields
}
func (*UniqEvents) AddEvent ¶
func (e *UniqEvents) AddEvent(dbEventID string, qChan chan string)
func (*UniqEvents) GetEventCount ¶
func (e *UniqEvents) GetEventCount() int
func (*UniqEvents) RemoveEvent ¶
func (e *UniqEvents) RemoveEvent(dbEventID string, qChan chan string)
Click to show internal directories.
Click to hide internal directories.