Compartir a través de


WebPubSubServiceClient.SendToGroupAsync Método

Definición

Sobrecargas

SendToGroupAsync(String, RequestContent, ContentType, IEnumerable<String>, RequestContext)

Enviar contenido dentro del cuerpo de la solicitud a un grupo de conexiones.

SendToGroupAsync(String, RequestContent, ContentType, IEnumerable<String>, String, RequestContext)

Enviar contenido dentro del cuerpo de la solicitud a un grupo de conexiones.

SendToGroupAsync(String, String, ContentType)

Enviar un mensaje a un grupo de conexiones.

SendToGroupAsync(String, RequestContent, ContentType, IEnumerable<String>, RequestContext)

Source:
WebPubSubServiceClient.cs

Enviar contenido dentro del cuerpo de la solicitud a un grupo de conexiones.

public virtual System.Threading.Tasks.Task<Azure.Response> SendToGroupAsync (string group, Azure.Core.RequestContent content, Azure.Core.ContentType contentType, System.Collections.Generic.IEnumerable<string> excluded, Azure.RequestContext context);
abstract member SendToGroupAsync : string * Azure.Core.RequestContent * Azure.Core.ContentType * seq<string> * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.SendToGroupAsync : string * Azure.Core.RequestContent * Azure.Core.ContentType * seq<string> * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function SendToGroupAsync (group As String, content As RequestContent, contentType As ContentType, excluded As IEnumerable(Of String), context As RequestContext) As Task(Of Response)

Parámetros

group
String

Nombre del grupo de destino, cuya longitud debe ser mayor que 0 y menor que 1025.

content
RequestContent

Contenido que se va a enviar como el cuerpo de la solicitud. Los detalles del esquema del cuerpo de la solicitud se encuentran en la sección Comentarios a continuación.

contentType
ContentType

Cargue el tipo de archivo. Valores permitidos: "application/json" | "application/octet-stream" | "text/plain".

excluded
IEnumerable<String>

Identificadores de conexión excluidos.

context
RequestContext

Contexto de solicitud, que puede invalidar los comportamientos predeterminados de la canalización de cliente por llamada.

Devoluciones

Respuesta devuelta desde el servicio.

Excepciones

group o content es null.

group es una cadena vacía y se espera que no esté vacía.

El servicio devolvió un código de estado no correcto.

Ejemplos

En este ejemplo se muestra cómo llamar a SendToGroupAsync con los parámetros necesarios y el contenido de la solicitud.

var client = new WebPubSubServiceClient("<https://my-service.azure.com>", "<hub>");

var data = File.OpenRead("<filePath>");

Response response = await client.SendToGroupAsync("<group>", RequestContent.Create(data), ContentType.ApplicationOctetStream);
Console.WriteLine(response.Status);

En este ejemplo se muestra cómo llamar a SendToGroupAsync con todos los parámetros y solicitar contenido.

var client = new WebPubSubServiceClient("<https://my-service.azure.com>", "<hub>");

var data = File.OpenRead("<filePath>");

Response response = await client.SendToGroupAsync("<group>", RequestContent.Create(data), ContentType.ApplicationOctetStream, new String[]{"<excluded>"});
Console.WriteLine(response.Status);

Comentarios

Esquema para Response Error:

{
              code: string,
              message: string,
              target: string,
              details: [ErrorDetail],
              inner: {
                code: string,
                inner: InnerError
              }
            }

Se aplica a

SendToGroupAsync(String, RequestContent, ContentType, IEnumerable<String>, String, RequestContext)

Source:
WebPubSubServiceClient.cs

Enviar contenido dentro del cuerpo de la solicitud a un grupo de conexiones.

public virtual System.Threading.Tasks.Task<Azure.Response> SendToGroupAsync (string group, Azure.Core.RequestContent content, Azure.Core.ContentType contentType, System.Collections.Generic.IEnumerable<string> excluded = default, string filter = default, Azure.RequestContext context = default);
abstract member SendToGroupAsync : string * Azure.Core.RequestContent * Azure.Core.ContentType * seq<string> * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.SendToGroupAsync : string * Azure.Core.RequestContent * Azure.Core.ContentType * seq<string> * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function SendToGroupAsync (group As String, content As RequestContent, contentType As ContentType, Optional excluded As IEnumerable(Of String) = Nothing, Optional filter As String = Nothing, Optional context As RequestContext = Nothing) As Task(Of Response)

Parámetros

group
String

Nombre del grupo de destino, cuya longitud debe ser mayor que 0 y menor que 1025.

content
RequestContent

Contenido que se va a enviar como el cuerpo de la solicitud. Los detalles del esquema del cuerpo de la solicitud se encuentran en la sección Comentarios a continuación.

contentType
ContentType

Cargue el tipo de archivo. Valores permitidos: "application/json" | "application/octet-stream" | "text/plain".

excluded
IEnumerable<String>

Identificadores de conexión excluidos.

filter
String

Siguiendo la sintaxis de filtro de OData para filtrar los suscriptores que reciben los mensajes.

context
RequestContext

Contexto de solicitud, que puede invalidar los comportamientos predeterminados de la canalización de cliente por llamada.

Devoluciones

Respuesta devuelta desde el servicio.

Excepciones

group o content es null.

group es una cadena vacía y se espera que no esté vacía.

El servicio devolvió un código de estado no correcto.

Ejemplos

En este ejemplo se muestra cómo llamar a SendToGroupAsync con los parámetros necesarios y el contenido de la solicitud.

var client = new WebPubSubServiceClient("<https://my-service.azure.com>", "<hub>");

var data = File.OpenRead("<filePath>");

Response response = await client.SendToGroupAsync("<group>", RequestContent.Create(data), ContentType.ApplicationOctetStream);
Console.WriteLine(response.Status);

En este ejemplo se muestra cómo llamar a SendToGroupAsync con todos los parámetros y solicitar contenido.

var client = new WebPubSubServiceClient("<https://my-service.azure.com>", "<hub>");

var data = File.OpenRead("<filePath>");

Response response = await client.SendToGroupAsync("<group>", RequestContent.Create(data), ContentType.ApplicationOctetStream, new String[]{"<excluded>"}, "<filter>");
Console.WriteLine(response.Status);

Se aplica a

SendToGroupAsync(String, String, ContentType)

Source:
WebPubSubServiceClient.cs

Enviar un mensaje a un grupo de conexiones.

public virtual System.Threading.Tasks.Task<Azure.Response> SendToGroupAsync (string group, string content, Azure.Core.ContentType contentType = default);
abstract member SendToGroupAsync : string * string * Azure.Core.ContentType -> System.Threading.Tasks.Task<Azure.Response>
override this.SendToGroupAsync : string * string * Azure.Core.ContentType -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function SendToGroupAsync (group As String, content As String, Optional contentType As ContentType = Nothing) As Task(Of Response)

Parámetros

group
String

Nombre del grupo de destino, cuya longitud debe ser mayor que 0 y menor que 1025.

content
String
contentType
ContentType

El valor predeterminado es ContentType.PlainText.

Devoluciones

Si Response se ejecuta correctamente.

Se aplica a