JsonRpc Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Manages a JSON-RPC connection with another entity over a Stream.
public class JsonRpc : IDisposable, Microsoft.IDisposableObservable
public class JsonRpc : IDisposable, Microsoft.IDisposableObservable, StreamJsonRpc.Reflection.IJsonRpcFormatterCallbacks, StreamJsonRpc.Reflection.IJsonRpcTracingCallbacks
type JsonRpc = class
interface IDisposableObservable
interface IDisposable
type JsonRpc = class
interface IDisposableObservable
interface IDisposable
interface IJsonRpcFormatterCallbacks
interface IJsonRpcTracingCallbacks
Public Class JsonRpc
Implements IDisposable, IDisposableObservable
Public Class JsonRpc
Implements IDisposable, IDisposableObservable, IJsonRpcFormatterCallbacks, IJsonRpcTracingCallbacks
- Inheritance
-
JsonRpc
- Implements
Constructors
JsonRpc(DelimitedMessageHandler, Object) |
Initializes a new instance of the JsonRpc class. |
JsonRpc(IJsonRpcMessageHandler, Object) |
Initializes a new instance of the JsonRpc class. |
JsonRpc(IJsonRpcMessageHandler) |
Initializes a new instance of the JsonRpc class. |
JsonRpc(Stream, Stream, Object) |
Initializes a new instance of the JsonRpc class that uses HeaderDelimitedMessageHandler around messages serialized using the JsonMessageFormatter. |
JsonRpc(Stream) |
Initializes a new instance of the JsonRpc class that uses HeaderDelimitedMessageHandler around messages serialized using the JsonMessageFormatter. |
Properties
ActivityTracingStrategy |
Gets or sets the strategy for propagating activity IDs over RPC. |
AllowModificationWhileListening |
Gets or sets a value indicating whether configuration of this instance can be changed after StartListening() or Attach(Stream, Object) has been called. |
CancellationStrategy |
Gets or sets the cancellation strategy to use. |
CancelLocallyInvokedMethodsWhenConnectionIsClosed |
Gets or sets a value indicating whether to cancel all methods dispatched locally that accept a CancellationToken when the connection with the remote party is closed. |
Completion |
Gets a Task that completes when this instance is disposed or when listening has stopped whether by error, disposal or the stream closing. |
DispatchCompletion |
Gets a Task that completes when no local target methods are executing from an RPC call. |
Encoding |
Gets or sets the encoding to use for transmitted JSON messages. |
ExceptionStrategy |
Gets or sets a value indicating whether exceptions thrown by the RPC server should be fully serialized for the RPC client to then deserialize. |
IsDisposed | System.Object.IsDisposed |
JsonSerializer |
Gets the JsonSerializer used when serializing and deserializing method arguments and return values. |
JsonSerializerFormatting |
Gets or sets the formatting to use when serializing JSON-RPC messages. |
MessageHandler |
Gets the message handler used to send and receive messages. |
SynchronizationContext |
Gets or sets the SynchronizationContext to use when invoking methods requested by the remote party. |
TraceSource |
Gets or sets the TraceSource used to trace JSON-RPC messages and events. |
Methods
AddLocalRpcMethod(MethodInfo, Object, JsonRpcMethodAttribute) |
Adds a handler for an RPC method with a given name. |
AddLocalRpcMethod(String, Delegate) |
Adds a handler for an RPC method with a given name. |
AddLocalRpcMethod(String, MethodInfo, Object) |
Adds a handler for an RPC method with a given name. |
AddLocalRpcTarget(Object, JsonRpcTargetOptions) |
Adds the specified target as possible object to invoke when incoming messages are received. The target object should not inherit from each other and are invoked in the order which they are added. |
AddLocalRpcTarget(Object) |
Adds the specified target as possible object to invoke when incoming messages are received. The target object should not inherit from each other and are invoked in the order which they are added. |
AddLocalRpcTarget(Type, Object, JsonRpcTargetOptions) | StreamJsonRpc.Reflection.RpcTargetInfo.AddLocalRpcTarget(System.Type,System.Object,StreamJsonRpc.JsonRpcTargetOptions,System.Boolean) |
AddLocalRpcTarget<T>(T, JsonRpcTargetOptions) | |
AddRemoteRpcTarget(JsonRpc) |
Adds a remote rpc connection so calls can be forwarded to the remote target if local targets do not handle it. |
Attach(Stream, Object) |
Initializes a new instance of the JsonRpc class that uses HeaderDelimitedMessageHandler around messages serialized using the JsonMessageFormatter, and immediately starts listening. |
Attach(Stream, Stream, Object) |
Initializes a new instance of the JsonRpc class that uses HeaderDelimitedMessageHandler around messages serialized using the JsonMessageFormatter, and immediately starts listening. |
Attach(Type, JsonRpcProxyOptions) |
Creates a JSON-RPC client proxy that conforms to the specified server interface. |
Attach(Type) |
Creates a JSON-RPC client proxy that conforms to the specified server interface. |
Attach<T>() |
Creates a JSON-RPC client proxy that conforms to the specified server interface. |
Attach<T>(IJsonRpcMessageHandler, JsonRpcProxyOptions) |
Creates a JSON-RPC client proxy that conforms to the specified server interface. |
Attach<T>(IJsonRpcMessageHandler) |
Creates a JSON-RPC client proxy that conforms to the specified server interface. |
Attach<T>(JsonRpcProxyOptions) |
Creates a JSON-RPC client proxy that conforms to the specified server interface. |
Attach<T>(Stream, Stream) |
Creates a JSON-RPC client proxy that conforms to the specified server interface. |
Attach<T>(Stream) |
Creates a JSON-RPC client proxy that conforms to the specified server interface. |
CreateErrorDetails(JsonRpcRequest, Exception) |
Creates the JsonRpcError.ErrorDetail to be used as the value for the error property to be sent back to the client in response to an exception being thrown from an RPC method invoked locally. |
CreateExceptionFromRpcError(JsonRpcRequest, JsonRpcError) |
Creates a RemoteRpcException (or derived type) that represents the data found in a JSON-RPC error response. This is called on the client side to produce the exception that will be thrown back to the RPC client. |
CreateNewRequestId() |
Creates a unique RequestId for an outbound request. |
DispatchRequestAsync(JsonRpcRequest, TargetMethod, CancellationToken) |
Invokes the method on the local RPC target object and converts the response into a JSON-RPC result message. |
Dispose() |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
Dispose(Boolean) |
Disposes managed and native resources held by this instance. |
GetErrorDetailsDataType(JsonRpcError) |
Determines the type that the Data object should be deserialized to for an incoming JsonRpcError message. |
GetJsonRpcMethodAttribute(String, ReadOnlySpan<ParameterInfo>) |
Gets the JsonRpcMethodAttribute for a previously discovered RPC method, if there is one. |
InvokeAsync(String, Object) |
Invokes a given method on a JSON-RPC server. |
InvokeAsync(String, Object[]) |
Invokes a given method on a JSON-RPC server. |
InvokeAsync<TResult>(String, Object) |
Invokes a given method on a JSON-RPC server. |
InvokeAsync<TResult>(String, Object[]) |
Invokes a given method on a JSON-RPC server. |
InvokeCoreAsync<TResult>(Nullable<Int32>, String, IReadOnlyList<Object>, CancellationToken, Boolean) |
Invokes the specified RPC method |
InvokeCoreAsync<TResult>(Nullable<Int32>, String, IReadOnlyList<Object>, CancellationToken) |
Invokes the specified RPC method |
InvokeCoreAsync<TResult>(Nullable<Int64>, String, IReadOnlyList<Object>, CancellationToken, Boolean) |
Obsolete.
Invokes a given method on a JSON-RPC server. |
InvokeCoreAsync<TResult>(Nullable<Int64>, String, IReadOnlyList<Object>, CancellationToken) |
Obsolete.
Invokes the specified RPC method. |
InvokeCoreAsync<TResult>(RequestId, String, IReadOnlyList<Object>, CancellationToken, Boolean) |
Invokes the specified RPC method. |
InvokeCoreAsync<TResult>(RequestId, String, IReadOnlyList<Object>, CancellationToken) |
Invokes the specified RPC method. |
InvokeCoreAsync<TResult>(RequestId, String, IReadOnlyList<Object>, IReadOnlyList<Type>, IReadOnlyDictionary<String,Type>, CancellationToken, Boolean) |
Invokes a given method on a JSON-RPC server. |
InvokeWithCancellationAsync(String, IReadOnlyList<Object>, CancellationToken) |
Invokes a given method on a JSON-RPC server. |
InvokeWithCancellationAsync(String, IReadOnlyList<Object>, IReadOnlyList<Type>, CancellationToken) |
Invokes a given method on a JSON-RPC server. |
InvokeWithCancellationAsync<TResult>(String, IReadOnlyList<Object>, CancellationToken) |
Invokes a given method on a JSON-RPC server. |
InvokeWithCancellationAsync<TResult>(String, IReadOnlyList<Object>, IReadOnlyList<Type>, CancellationToken) |
Invokes a given method on a JSON-RPC server. |
InvokeWithParameterObjectAsync(String, Object, CancellationToken) |
Invokes a given method on a JSON-RPC server. |
InvokeWithParameterObjectAsync(String, Object, IReadOnlyDictionary<String,Type>, CancellationToken) |
Invokes a given method on a JSON-RPC server. |
InvokeWithParameterObjectAsync<TResult>(String, Object, CancellationToken) |
Invokes a given method on a JSON-RPC server. |
InvokeWithParameterObjectAsync<TResult>(String, Object, IReadOnlyDictionary<String,Type>, CancellationToken) |
Invokes a given method on a JSON-RPC server. |
IsFatalException(Exception) |
Indicates whether the connection should be closed when the server throws an exception. |
LoadType(String, String) |
Attempts to load a type based on its full name and possibly assembly name. |
NotifyAsync(String, Object) |
Invokes a given method on a JSON-RPC server without waiting for its response. |
NotifyAsync(String, Object[], IReadOnlyList<Type>) |
Invokes a given method on a JSON-RPC server without waiting for its response. |
NotifyAsync(String, Object[]) |
Invoke a method on the server and don't wait for its completion, fire-and-forget style. |
NotifyWithParameterObjectAsync(String, Object, IReadOnlyDictionary<String,Type>) |
Invokes a given method on a JSON-RPC server without waiting for its response. |
NotifyWithParameterObjectAsync(String, Object) |
Invoke a method on the server and don't wait for its completion, fire-and-forget style. The parameter is passed as an object. |
OnRequestTransmissionAborted(JsonRpcRequest) |
Raises the RequestTransmissionAborted event. |
OnResponseReceived(JsonRpcMessage) |
Raises the ResponseReceived event. |
OnResponseSent(JsonRpcMessage) |
Raises the ResponseSent event. |
StartListening() |
Starts listening to incoming messages. |
Events
Disconnected |
Raised when the underlying stream is disconnected. |