ing
This commit is contained in:
49
handler/file/file.go
Normal file
49
handler/file/file.go
Normal file
@@ -0,0 +1,49 @@
|
||||
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 interface{}) (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 interface{}) error {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user