|
|
|
@ -22,8 +22,8 @@ func WsjsonSend(ctx context.Context, conn *websocket.Conn, sendval interface{})
|
|
|
|
|
|
|
|
|
|
return nil, receiveval
|
|
|
|
|
}
|
|
|
|
|
func WsjsonReceive(ctx context.Context, conn *websocket.Conn, dosth func(interface{}) interface{}) (err error, receiveval interface{}) {
|
|
|
|
|
var sendval interface{}
|
|
|
|
|
func WsjsonReceive(ctx context.Context, conn *websocket.Conn, dosth func(interface{}) interface{}) (err error, sendval interface{}) {
|
|
|
|
|
var receiveval interface{}
|
|
|
|
|
err = nil
|
|
|
|
|
|
|
|
|
|
//Receive
|
|
|
|
@ -31,7 +31,11 @@ func WsjsonReceive(ctx context.Context, conn *websocket.Conn, dosth func(interfa
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
sendval = dosth(receiveval)
|
|
|
|
|
if dosth != nil {
|
|
|
|
|
sendval = dosth(receiveval)
|
|
|
|
|
} else {
|
|
|
|
|
sendval = receiveval
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Send
|
|
|
|
|
err = wsjson.Write(ctx, conn, sendval.(string))
|
|
|
|
|