This commit is contained in:
crusader 2017-09-01 11:18:09 +09:00
parent 177a3c9a4c
commit 0669531b0f
2 changed files with 7 additions and 2 deletions

View File

@ -90,7 +90,7 @@ func (soc *socket) run() {
func (soc *socket) onDisconnected() {
soc.disconnectCh <- true
soc.sh.(*SocketHandlers).onDisconnected(soc)
soc.sh.getOnDisconnected()(soc)
}
func (soc *socket) onMessage(messageType int, r io.Reader) {

View File

@ -2,6 +2,10 @@ package overflow_gateway_websocket
import "time"
type (
onDisconnectedFunc func(soc Socket)
)
// SocketHandler is configuration of the websocket server
type SocketHandler interface {
GetMaxMessageSize() int64
@ -12,6 +16,7 @@ type SocketHandler interface {
GetPingPeriod() time.Duration
IsBinaryMessage() bool
GetProtocol() ProtocolHandler
setOnDisconnected(cb func(soc Socket))
setOnDisconnected(cb onDisconnectedFunc)
getOnDisconnected() onDisconnectedFunc
Validate()
}