removed OnCreated event.

This commit is contained in:
Miroslav Šedivý 2020-11-30 18:52:16 +01:00
parent 743ab2bf6a
commit 753fb01955
5 changed files with 2 additions and 22 deletions

View File

@ -220,8 +220,8 @@ func (manager *SessionManagerCtx) OnHostCleared(listener func(session types.Sess
})
}
func (manager *SessionManagerCtx) OnCreated(listener func(session types.Session)) {
manager.emmiter.On("created", func(payload ...interface{}) {
func (manager *SessionManagerCtx) OnConnected(listener func(session types.Session)) {
manager.emmiter.On("connected", func(payload ...interface{}) {
// Start streaming, when first joins
if !manager.capture.Streaming() {
manager.capture.StartStream()
@ -231,12 +231,6 @@ func (manager *SessionManagerCtx) OnCreated(listener func(session types.Session)
})
}
func (manager *SessionManagerCtx) OnConnected(listener func(session types.Session)) {
manager.emmiter.On("connected", func(payload ...interface{}) {
listener(payload[0].(*SessionCtx))
})
}
func (manager *SessionManagerCtx) OnDisconnected(listener func(session types.Session)) {
manager.emmiter.On("disconnected", func(payload ...interface{}) {
// Stop streaming, if everyone left

View File

@ -45,7 +45,6 @@ func (session *SessionCtx) Connected() bool {
func (session *SessionCtx) SetWebSocketPeer(websocket_peer types.WebSocketPeer) {
session.websocket_peer = websocket_peer
session.manager.emmiter.Emit("created", session)
}
func (session *SessionCtx) SetWebSocketConnected(connected bool) {

View File

@ -46,7 +46,6 @@ type SessionManager interface {
OnHost(listener func(session Session))
OnHostCleared(listener func(session Session))
OnCreated(listener func(session Session))
OnConnected(listener func(session Session))
OnDisconnected(listener func(session Session))

View File

@ -6,10 +6,6 @@ import (
"demodesk/neko/internal/types/message"
)
func (h *MessageHandlerCtx) SessionCreated(session types.Session) error {
return nil
}
func (h *MessageHandlerCtx) SessionConnected(session types.Session) error {
// create member list
members := []*message.MembersListEntry{}

View File

@ -49,14 +49,6 @@ type WebSocketManagerCtx struct {
}
func (ws *WebSocketManagerCtx) Start() {
ws.sessions.OnCreated(func(session types.Session) {
if err := ws.handler.SessionCreated(session); err != nil {
ws.logger.Warn().Str("id", session.ID()).Err(err).Msg("session created with an error")
} else {
ws.logger.Debug().Str("id", session.ID()).Msg("session created")
}
})
ws.sessions.OnConnected(func(session types.Session) {
if err := ws.handler.SessionConnected(session); err != nil {
ws.logger.Warn().Str("id", session.ID()).Err(err).Msg("session connected with an error")