Add method to remove message handler
This commit is contained in:
parent
52a9157a07
commit
bb857ced6b
14
handler.go
14
handler.go
|
@ -2,9 +2,10 @@ package gosocketio
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"forge.cadoles.com/Pyxis/golang-socketio/protocol"
|
|
||||||
"sync"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"forge.cadoles.com/Pyxis/golang-socketio/protocol"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -52,6 +53,15 @@ func (m *methods) On(method string, f interface{}) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Remove message processing function
|
||||||
|
*/
|
||||||
|
func (m *methods) Off(method string) {
|
||||||
|
m.messageHandlersLock.Lock()
|
||||||
|
defer m.messageHandlersLock.Unlock()
|
||||||
|
delete(m.messageHandlers, method)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Find message processing function associated with given method
|
Find message processing function associated with given method
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue