server.go
func (s *Server) SendRequest(connID string, method string, params interface{}, resHandler func(ctx *ResCtx) error) (reqID string, err error) {
	if !s.running.Load().(bool) {
		return "", errors.New("use of closed server")
	}

	if conn, ok := s.conns.GetOk(connID); ok {
		reqID, err = conn.(*Conn).SendRequest(method, params, resHandler)
		// todo: only log in debug mode?
		log.Printf("server: send-request: connID: %v, reqID: %v, method: %v, params: %#v, err (if any): %v", connID, reqID, method, params, err)
		return
	}

	return "", fmt.Errorf("connection with requested ID: %v does not exist", connID)
}
func (s *Server) SendRequest(connID string, method string, params interface{}, resHandler func(ctx *ResCtx) error) (reqID string, err error) {
	if !s.running.Load().(bool) {
		return "", errors.New("use of closed server")
	}

	if conn, ok := s.conns.GetOk(connID); ok {
		reqID, err = conn.(*Conn).SendRequest(method, params, resHandler)
		// todo: only log in debug mode?
		log.Printf("server: send-request: connID: %v, reqID: %v, method: %v, params: %#v, err (if any): %v", connID, reqID, method, params, err)
		return
	}

	return "", fmt.Errorf("connection with requested ID: %v does not exist", connID)
}
func ( s * Server ) SendRequest ( connID string , method string , params interface { } , resHandler func ( ctx * ResCtx ) error ) ( reqID string , err error ) { if ! s . running . Load ( ) . ( bool ) { return " " , errors . New ( " " ) } if conn , ok := s . conns . GetOk ( connID ) ; ok { reqID , err = conn . ( * Conn ) . SendRequest ( method , params , resHandler ) // todo: only log in debug mode? log . Printf ( " " , connID , reqID , method , params , err ) return } return " " , fmt . Errorf ( " " , connID ) }
// SendRequest sends a JSON-RPC request through the connection denoted by the connection ID with an auto generated request ID.
// resHandler is called when a response is returned.
SendRequest sends a JSON - RPC request through the connection denoted by the connection ID with an auto generated request ID . resHandler is called when a response is returned .