WebPubSubServiceClient.SendToAll Method
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.
Overloads
SendToAll(String, ContentType) |
Broadcast message to all the connected client connections. |
SendToAll(RequestContent, ContentType, IEnumerable<String>, RequestContext) |
Broadcast content inside request body to all the connected client connections. |
SendToAll(RequestContent, ContentType, IEnumerable<String>, String, RequestContext) |
[Protocol Method] Broadcast content inside request body to all the connected client connections.
|
SendToAll(String, ContentType)
Broadcast message to all the connected client connections.
public virtual Azure.Response SendToAll (string content, Azure.Core.ContentType contentType = default);
abstract member SendToAll : string * Azure.Core.ContentType -> Azure.Response
override this.SendToAll : string * Azure.Core.ContentType -> Azure.Response
Public Overridable Function SendToAll (content As String, Optional contentType As ContentType = Nothing) As Response
Parameters
- content
- String
- contentType
- ContentType
Defaults to ContentType.PlainText.
Returns
A Response if successful.
Applies to
SendToAll(RequestContent, ContentType, IEnumerable<String>, RequestContext)
- Source:
- WebPubSubServiceClient.cs
Broadcast content inside request body to all the connected client connections.
public virtual Azure.Response SendToAll (Azure.Core.RequestContent content, Azure.Core.ContentType contentType, System.Collections.Generic.IEnumerable<string> excluded, Azure.RequestContext context);
abstract member SendToAll : Azure.Core.RequestContent * Azure.Core.ContentType * seq<string> * Azure.RequestContext -> Azure.Response
override this.SendToAll : Azure.Core.RequestContent * Azure.Core.ContentType * seq<string> * Azure.RequestContext -> Azure.Response
Public Overridable Function SendToAll (content As RequestContent, contentType As ContentType, excluded As IEnumerable(Of String), context As RequestContext) As Response
Parameters
- 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
content
is null.
Service returned a non-success status code.
Examples
This sample shows how to call SendToAll with required parameters and request content.
var client = new WebPubSubServiceClient("<https://my-service.azure.com>", "<hub>");
var data = File.OpenRead("<filePath>");
Response response = client.SendToAll(RequestContent.Create(data), ContentType.ApplicationOctetStream);
Console.WriteLine(response.Status);
This sample shows how to call SendToAll with all parameters and request content.
var client = new WebPubSubServiceClient("<https://my-service.azure.com>", "<hub>");
var data = File.OpenRead("<filePath>");
Response response = client.SendToAll(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
SendToAll(RequestContent, ContentType, IEnumerable<String>, String, RequestContext)
- Source:
- WebPubSubServiceClient.cs
[Protocol Method] Broadcast content inside request body to all the connected client connections.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual Azure.Response SendToAll (Azure.Core.RequestContent content, Azure.Core.ContentType contentType, System.Collections.Generic.IEnumerable<string> excluded = default, string filter = default, Azure.RequestContext context = default);
abstract member SendToAll : Azure.Core.RequestContent * Azure.Core.ContentType * seq<string> * string * Azure.RequestContext -> Azure.Response
override this.SendToAll : Azure.Core.RequestContent * Azure.Core.ContentType * seq<string> * string * Azure.RequestContext -> Azure.Response
Public Overridable Function SendToAll (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
- content
- RequestContent
The content to send as the body of the request.
- 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
content
is null.
Service returned a non-success status code.
Examples
This sample shows how to call SendToAll.
WebPubSubServiceClient client = new WebPubSubServiceClient("<Endpoint>", "<Hub>");
using RequestContent content = RequestContent.Create(File.OpenRead("<filePath>"));
Response response = client.SendToAll(content, new ContentType("application/json"));
Console.WriteLine(response.Status);
This sample shows how to call SendToAll with all parameters and request content.
WebPubSubServiceClient client = new WebPubSubServiceClient("<Endpoint>", "<Hub>");
using RequestContent content = RequestContent.Create(File.OpenRead("<filePath>"));
Response response = client.SendToAll(content, new ContentType("application/json"), excluded: new string[] { "<excluded>" }, filter: "<filter>");
Console.WriteLine(response.Status);
Applies to
Azure SDK for .NET