|
@@ -15,7 +15,7 @@ type HandleDisconnectFunc func(groupID string)
|
|
|
type HandleErrorFunc func(groupID string, err error)
|
|
|
type HandleCloseFunc func(groupID string, i int, s string) error
|
|
|
type HandlePongFunc func(groupID string)
|
|
|
-type HandleMessageFunc func(groupID string, message []byte)
|
|
|
+type HandleMessageFunc func(groupID string, message []byte, context any)
|
|
|
|
|
|
var managerInstance *Manager
|
|
|
|
|
@@ -111,7 +111,7 @@ func (m *Manager) HandleRequest(groupID string, w http.ResponseWriter, r *http.R
|
|
|
func (m *Manager) HandleMessage(handleMessageFunc HandleMessageFunc) {
|
|
|
m.melodyInstance.HandleMessage(func(session *melody.Session, bytes []byte) {
|
|
|
if handleMessageFunc != nil {
|
|
|
- handleMessageFunc(session.Keys[groupIDKey].(string), bytes)
|
|
|
+ handleMessageFunc(session.Keys[groupIDKey].(string), bytes, session.Keys[connectionContextKey])
|
|
|
}
|
|
|
})
|
|
|
}
|