crusader 9c0856c2a5 ing
2017-08-28 18:41:41 +09:00

50 lines
985 B
Go

package file
import (
"log"
"git.loafle.net/overflow/overflow_gateway_web/handler"
gws "git.loafle.net/overflow/overflow_gateway_websocket"
"git.loafle.net/overflow/overflow_gateway_websocket/protocol/jsonrpc"
)
type FileHandler interface {
handler.Handler
}
type fileHandler struct {
co *gws.SocketOptions
ho *jsonrpc.Options
handler gws.MessageHandler
}
func New() FileHandler {
h := &fileHandler{}
h.ho = &jsonrpc.Options{
OnRequest: h.onRequest,
OnNotify: h.onNotify,
}
h.handler = jsonrpc.NewHandler(h.ho)
h.co = &gws.SocketOptions{
Handler: h.handler,
}
return h
}
func (h *fileHandler) GetSocketOption() *gws.SocketOptions {
return h.co
}
func (h *fileHandler) onRequest(soc gws.Socket, method string, params []string) (interface{}, error) {
log.Printf("path: %s, m: %s, params: %v", soc.Path(), method, params)
return nil, nil
}
func (h *fileHandler) onNotify(soc gws.Socket, method string, params []string) error {
return nil
}