OxL Справочник OxL
РусскийEnglish

fn callRaw

Sends the encoded request message to rpc method of service S through its wire entry; the encoded response message or a NetError (an application error is a ProtocolError here: see callDetails).

Example:

oxl✓ проверяется в CI
use std.rpc { callRaw }

service S {
  @public rpc ping() -> str
}

impl S {
  rpc ping() { "pong" }
}

fn main() io, net {
  match callRaw(S, "ping", b"") {
    bytes b => print("reply of {b.len() > 0}")
    NetError e => print("failed")
  }
}
Вывод
reply of true
@intrinsic("rpc.callRaw") pub(api) fn callRaw(S: type, method: str, request: bytes) -> bytes | NetError  net

С версии. 1.0.0-beta

Параметры

ИмяТип
Stype
methodstr
requestbytes

Возвращает

bytes

Ошибки

  • NetError
  • `NetError`; an application error of the handler is reported as `ProtocolError` (read it with `callDetails`).

Эффекты

net

Определено в: std/rpc/rpc.oxl:207

См. также