ing
This commit is contained in:
parent
e2ef11e395
commit
177a3c9a4c
|
@ -131,7 +131,7 @@ func (s *server) Sockets() map[string]Socket {
|
|||
}
|
||||
|
||||
func (s *server) HandleSocket(pattern string, soch SocketHandler) {
|
||||
soch.(*SocketHandlers).onDisconnected = s.onDisconnected
|
||||
soch.setOnDisconnected(s.onDisconnected)
|
||||
|
||||
soch.Validate()
|
||||
s._handlers[pattern] = soch
|
||||
|
|
|
@ -12,6 +12,6 @@ type SocketHandler interface {
|
|||
GetPingPeriod() time.Duration
|
||||
IsBinaryMessage() bool
|
||||
GetProtocol() ProtocolHandler
|
||||
|
||||
setOnDisconnected(cb func(soc Socket))
|
||||
Validate()
|
||||
}
|
||||
|
|
|
@ -61,6 +61,10 @@ func (sh *SocketHandlers) GetProtocol() ProtocolHandler {
|
|||
return sh.Protocol
|
||||
}
|
||||
|
||||
func (sh *SocketHandlers) setOnDisconnected(cb func(soc Socket)) {
|
||||
sh.onDisconnected = cb
|
||||
}
|
||||
|
||||
// Validate validates the configuration
|
||||
func (sh *SocketHandlers) Validate() {
|
||||
if nil == sh.Protocol {
|
||||
|
|
Loading…
Reference in New Issue
Block a user