nonce 응답 추가

This commit is contained in:
2023-12-19 17:04:14 +09:00
parent 17593f74c6
commit c9ac5980a5
3 changed files with 52 additions and 23 deletions

View File

@ -2,6 +2,7 @@ package wshandler
import (
"encoding/json"
"fmt"
"io"
"reflect"
"strings"
@ -175,13 +176,10 @@ func (hc *WebsocketPeerApiBroker) ClientDisconnected(recv any, reason string) {
}
}
func (hc *WebsocketPeerApiBroker) Call(recv any, funcname string, r io.Reader) {
func (hc *WebsocketPeerApiBroker) Call(recv any, funcname string, r io.Reader) (any, error) {
if found := hc.methods[funcname]; found != nil {
_, err := found(recv, r)
if err != nil {
logger.Println("api call is failed. err :", err)
}
} else {
logger.Println("api is not found :", funcname)
return found(recv, r)
}
return nil, fmt.Errorf("api is not found : %s", funcname)
}