Polhem.JsonRpc.Payload.Client
1.4.0
dotnet add package Polhem.JsonRpc.Payload.Client --version 1.4.0
NuGet\Install-Package Polhem.JsonRpc.Payload.Client -Version 1.4.0
<PackageReference Include="Polhem.JsonRpc.Payload.Client" Version="1.4.0" />
<PackageVersion Include="Polhem.JsonRpc.Payload.Client" Version="1.4.0" />
<PackageReference Include="Polhem.JsonRpc.Payload.Client" />
paket add Polhem.JsonRpc.Payload.Client --version 1.4.0
#r "nuget: Polhem.JsonRpc.Payload.Client, 1.4.0"
#:package Polhem.JsonRpc.Payload.Client@1.4.0
#addin nuget:?package=Polhem.JsonRpc.Payload.Client&version=1.4.0
#tool nuget:?package=Polhem.JsonRpc.Payload.Client&version=1.4.0
Polhem.JsonRpc.Payload.Client
The client half of Polhem.JsonRpc.Payload: PayloadConnector seals the parameters of each call into the payload
envelope (the codec, gzip for a longer body, the replay-protection frame and the encryption) and opens its result, so
an encrypted call is written exactly like a plain one with JsonRpcConnector.
It supports trimming and Native AOT, so it runs on iOS, Android and WebAssembly.
var payload = new PayloadProcessor(new PayloadOptions { RequireFrame = true });
var rpc = new PayloadConnector(connector, payload, new PayloadConnectorOptions { KeyProvider = () => sessionKey });
var added = await rpc.InvokeAsync<AddResponse>("Calculator.Add", new AddRequest { A = 1, B = 2 });
var plain = await rpc.InvokeAsync<AddResponse>("Calculator.Add", new AddRequest { A = 3, B = 4 }, PayloadFormat.Plain, CancellationToken.None);
Calls are encrypted unless PayloadConnectorOptions.Format or the call names another format. The connector keeps the
KeyProvider function it was created with and calls it on every encrypted call, so a key that changes after a sign-in
is used once the function returns it; setting KeyProvider afterwards has no effect. An encrypted call without a key
fails, and is never sent in a lower format. With PayloadOptions.RequireFrame on, each encoded or encrypted call takes
the next sequence number of the connector, or the number SequenceGenerator returns when the numbers must outlive it.
The result is opened into the type the call asks for; InvokeAsync<object> resolves the type the envelope names, which
must be registered with PayloadOptions.TypeResolver.
InvokeStreamingAsync<TItem, TResult> makes a streamed call: each item is opened as it arrives, and an encrypted one is
checked against the request and its place in the stream. A server on 1.3.0 or later answers a method that does not
stream with no items. A server on an earlier version seals the result of such a call as the answer to an ordinary
call, so an encrypted streamed call to it fails authentication; plain and encoded ones read the result.
Documentation and samples: https://github.com/polhem-dev/polhem-jsonrpc
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Polhem.JsonRpc.Client (>= 1.4.0)
- Polhem.JsonRpc.Payload (>= 1.4.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Polhem.JsonRpc.Payload.Client:
| Package | Downloads |
|---|---|
|
Polhem.Api.Client
Connector for local or remote invocation of backend logic. |
GitHub repositories
This package is not used by any popular GitHub repositories.