mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
removed OnCreated event.
This commit is contained in:
parent
743ab2bf6a
commit
753fb01955
@ -220,8 +220,8 @@ func (manager *SessionManagerCtx) OnHostCleared(listener func(session types.Sess
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (manager *SessionManagerCtx) OnCreated(listener func(session types.Session)) {
|
func (manager *SessionManagerCtx) OnConnected(listener func(session types.Session)) {
|
||||||
manager.emmiter.On("created", func(payload ...interface{}) {
|
manager.emmiter.On("connected", func(payload ...interface{}) {
|
||||||
// Start streaming, when first joins
|
// Start streaming, when first joins
|
||||||
if !manager.capture.Streaming() {
|
if !manager.capture.Streaming() {
|
||||||
manager.capture.StartStream()
|
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)) {
|
func (manager *SessionManagerCtx) OnDisconnected(listener func(session types.Session)) {
|
||||||
manager.emmiter.On("disconnected", func(payload ...interface{}) {
|
manager.emmiter.On("disconnected", func(payload ...interface{}) {
|
||||||
// Stop streaming, if everyone left
|
// Stop streaming, if everyone left
|
||||||
|
@ -45,7 +45,6 @@ func (session *SessionCtx) Connected() bool {
|
|||||||
|
|
||||||
func (session *SessionCtx) SetWebSocketPeer(websocket_peer types.WebSocketPeer) {
|
func (session *SessionCtx) SetWebSocketPeer(websocket_peer types.WebSocketPeer) {
|
||||||
session.websocket_peer = websocket_peer
|
session.websocket_peer = websocket_peer
|
||||||
session.manager.emmiter.Emit("created", session)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (session *SessionCtx) SetWebSocketConnected(connected bool) {
|
func (session *SessionCtx) SetWebSocketConnected(connected bool) {
|
||||||
|
@ -46,7 +46,6 @@ type SessionManager interface {
|
|||||||
|
|
||||||
OnHost(listener func(session Session))
|
OnHost(listener func(session Session))
|
||||||
OnHostCleared(listener func(session Session))
|
OnHostCleared(listener func(session Session))
|
||||||
OnCreated(listener func(session Session))
|
|
||||||
OnConnected(listener func(session Session))
|
OnConnected(listener func(session Session))
|
||||||
OnDisconnected(listener func(session Session))
|
OnDisconnected(listener func(session Session))
|
||||||
|
|
||||||
|
@ -6,10 +6,6 @@ import (
|
|||||||
"demodesk/neko/internal/types/message"
|
"demodesk/neko/internal/types/message"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (h *MessageHandlerCtx) SessionCreated(session types.Session) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *MessageHandlerCtx) SessionConnected(session types.Session) error {
|
func (h *MessageHandlerCtx) SessionConnected(session types.Session) error {
|
||||||
// create member list
|
// create member list
|
||||||
members := []*message.MembersListEntry{}
|
members := []*message.MembersListEntry{}
|
||||||
|
@ -49,14 +49,6 @@ type WebSocketManagerCtx struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ws *WebSocketManagerCtx) Start() {
|
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) {
|
ws.sessions.OnConnected(func(session types.Session) {
|
||||||
if err := ws.handler.SessionConnected(session); err != nil {
|
if err := ws.handler.SessionConnected(session); err != nil {
|
||||||
ws.logger.Warn().Str("id", session.ID()).Err(err).Msg("session connected with an error")
|
ws.logger.Warn().Str("id", session.ID()).Err(err).Msg("session connected with an error")
|
||||||
|
Loading…
Reference in New Issue
Block a user