Share via


WebPubSubServiceClient.SendToGroup Method

Definition

Overloads

SendToGroup(String, String, ContentType)

Send message to a group of connections.

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

Send content inside request body to a group of connections.

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

Send content inside request body to a group of connections.

SendToGroup(String, String, ContentType)

Source:
WebPubSubServiceClient_extensions.cs

Send message to a group of connections.

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

Parameters

group
String

Target group name, which length should be greater than 0 and less than 1025.

content
String
contentType
ContentType

Defaults to ContentType.PlainText.

Returns

A Response if successful.

Applies to

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

Source:
WebPubSubServiceClient.cs

Send content inside request body to a group of connections.

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

Parameters

group
String

Target group name, which length should be greater than 0 and less than 1025.

content
RequestContent

The content to send as the body of the request. Details of the request body schema are in the Remarks section below.

contentType
ContentType

Upload file type. Allowed values: "application/json" | "application/octet-stream" | "text/plain".

excluded
IEnumerable<String>

Excluded connection Ids.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

group or content is null.

group is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call SendToGroup with required parameters and request content.

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

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

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

This sample shows how to call SendToGroup with all parameters and request content.

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

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

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

Remarks

Schema for Response Error:

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

Applies to

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

Source:
WebPubSubServiceClient.cs

Send content inside request body to a group of connections.

public virtual Azure.Response SendToGroup (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 SendToGroup : string * Azure.Core.RequestContent * Azure.Core.ContentType * seq<string> * string * Azure.RequestContext -> Azure.Response
override this.SendToGroup : string * Azure.Core.RequestContent * Azure.Core.ContentType * seq<string> * string * Azure.RequestContext -> Azure.Response
Public Overridable Function SendToGroup (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 Response

Parameters

group
String

Target group name, which length should be greater than 0 and less than 1025.

content
RequestContent

The content to send as the body of the request. Details of the request body schema are in the Remarks section below.

contentType
ContentType

Upload file type. Allowed values: "application/json" | "application/octet-stream" | "text/plain".

excluded
IEnumerable<String>

Excluded connection Ids.

filter
String

Following OData filter syntax to filter out the subscribers receiving the messages.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

group or content is null.

group is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call SendToGroup with required parameters and request content.

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

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

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

This sample shows how to call SendToGroup with all parameters and request content.

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

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

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

Applies to