JsonRpc.NotifyAsync 方法

定义

重载

NotifyAsync(String, Object)

在 JSON-RPC 服务器上调用给定的方法,而无需等待其响应。

NotifyAsync(String, Object[])

在服务器上调用方法,不要等待其完成、触发和忘记样式。

NotifyAsync(String, Object[], IReadOnlyList<Type>)

在 JSON-RPC 服务器上调用给定的方法,而无需等待其响应。

NotifyAsync(String, Object)

在 JSON-RPC 服务器上调用给定的方法,而无需等待其响应。

public System.Threading.Tasks.Task NotifyAsync (string targetName, object argument);
public System.Threading.Tasks.Task NotifyAsync (string targetName, object? argument);
member this.NotifyAsync : string * obj -> System.Threading.Tasks.Task
Public Function NotifyAsync (targetName As String, argument As Object) As Task

参数

targetName
String

要调用的方法的名称。 不得为 null 或空。

argument
Object

方法参数,必须使用所选 IJsonRpcMessageFormatter参数进行序列化。

返回

将通知请求发送到服务器时完成的任务。

例外

如果 targetName 为 null。

当为空时 targetName 引发。

如果此实例 JsonRpc 已在此调用之前释放。

在传输请求时, (两端) 终止连接时引发。

(引发 IJsonRpcMessageFormatter 的任何异常通常由于序列化失败而) 。 使用 JsonMessageFormatter 时应为 Newtonsoft.Json.JsonSerializationException。 使用 MessagePackFormatter 时应为 MessagePack.MessagePackSerializationException

注解

忽略服务器端发生的任何错误。

适用于

NotifyAsync(String, Object[])

在服务器上调用方法,不要等待其完成、触发和忘记样式。

public System.Threading.Tasks.Task NotifyAsync (string targetName, params object[] arguments);
public System.Threading.Tasks.Task NotifyAsync (string targetName, params object?[]? arguments);
member this.NotifyAsync : string * obj[] -> System.Threading.Tasks.Task
Public Function NotifyAsync (targetName As String, ParamArray arguments As Object()) As Task

参数

targetName
String

在服务器上调用的方法的名称。 不得为 null 或空字符串。

arguments
Object[]

方法参数必须可序列化为 JSON。

返回

将通知请求发送到服务器时完成的任务。

例外

如果 targetName 为 null。

如果已释放此实例 JsonRpc

注解

忽略服务器端发生的任何错误。

适用于

NotifyAsync(String, Object[], IReadOnlyList<Type>)

在 JSON-RPC 服务器上调用给定的方法,而无需等待其响应。

public System.Threading.Tasks.Task NotifyAsync (string targetName, object?[]? arguments, System.Collections.Generic.IReadOnlyList<Type>? argumentDeclaredTypes);
member this.NotifyAsync : string * obj[] * System.Collections.Generic.IReadOnlyList<Type> -> System.Threading.Tasks.Task
Public Function NotifyAsync (targetName As String, arguments As Object(), argumentDeclaredTypes As IReadOnlyList(Of Type)) As Task

参数

targetName
String

要调用的方法的名称。 不得为 null 或空。

arguments
Object[]

要传递给已调用方法的参数。 必须使用所选 IJsonRpcMessageFormatter项对它们进行序列化。 如果 null,则不会传递任何参数。

argumentDeclaredTypes
IReadOnlyList<Type>

描述服务器应如何键入每个元素arguments的对象列表Type。 如果指定,则必须具有与不包含null任何元素完全相同的长度arguments。 如果 isParameterObject 为 true,则忽略此值。

返回

将通知请求发送到服务器时完成的任务。

注解

忽略服务器端发生的任何错误。

适用于