ing
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
package file
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"git.loafle.net/commons_go/logging"
|
||||
"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"
|
||||
@@ -13,20 +17,25 @@ type FileHandler interface {
|
||||
}
|
||||
|
||||
type fileHandler struct {
|
||||
ctx context.Context
|
||||
logger *zap.Logger
|
||||
co *gws.SocketOptions
|
||||
ho *jsonrpc.Options
|
||||
handler gws.MessageHandler
|
||||
}
|
||||
|
||||
func New() FileHandler {
|
||||
h := &fileHandler{}
|
||||
func New(ctx context.Context) FileHandler {
|
||||
h := &fileHandler{
|
||||
ctx: ctx,
|
||||
logger: logging.WithContext(ctx),
|
||||
}
|
||||
|
||||
h.ho = &jsonrpc.Options{
|
||||
OnRequest: h.onRequest,
|
||||
OnNotify: h.onNotify,
|
||||
}
|
||||
|
||||
h.handler = jsonrpc.NewHandler(h.ho)
|
||||
h.handler = jsonrpc.NewHandler(ctx, h.ho)
|
||||
|
||||
h.co = &gws.SocketOptions{
|
||||
Handler: h.handler,
|
||||
|
||||
Reference in New Issue
Block a user