mirror of
https://github.com/m1k1o/neko.git
synced 2025-08-02 16:29:55 +02:00
session id to session.
This commit is contained in:
parent
fdf5839547
commit
e5eaf5c60c
3 changed files with 12 additions and 18 deletions
|
@ -149,13 +149,13 @@ func (ws *WebSocketManagerCtx) Upgrade(w http.ResponseWriter, r *http.Request) e
|
|||
// }
|
||||
|
||||
socket := &WebSocketCtx{
|
||||
id: session.ID(),
|
||||
session: session,
|
||||
ws: ws,
|
||||
address: ip,
|
||||
connection: connection,
|
||||
}
|
||||
|
||||
ok, reason := ws.handler.Connected(session.ID(), socket)
|
||||
ok, reason := ws.handler.Connected(session, socket)
|
||||
if !ok {
|
||||
// TODO: Refactor
|
||||
if err = connection.WriteJSON(message.Disconnect{
|
||||
|
@ -226,7 +226,7 @@ func (ws *WebSocketManagerCtx) handle(connection *websocket.Conn, session types.
|
|||
Str("raw", string(raw)).
|
||||
Msg("received message from client")
|
||||
|
||||
if err := ws.handler.Message(session.ID(), raw); err != nil {
|
||||
if err := ws.handler.Message(session, raw); err != nil {
|
||||
ws.logger.Error().Err(err).Msg("message handler has failed")
|
||||
}
|
||||
case <-cancel:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue