Azure Web PubSub protobuf protocol client library for .NET
License
—
Deps
4
Install Size
—
Vulns
✓ 0
Published
Jul 24, 2023
$ dotnet add package WebPubSub.ProtobufThis library adds the protobuf subprotocols protobuf.reliable.webpubsub.azure.v1 and protobuf.webpubsub.azure.v1 to the Azure.Messaging.WebPubSub.Client library.
dotnet add package Azure.Messaging.WebPubSub.Client
dotnet add package WebPubSub.Protobuf.Protocols
You can find more info about the Web PubSub client library here.
WebPubSub.Client.Protobuf namespaceusing WebPubSub.Client.Protobuf
You can specify the protobuf subprotocol to be used by the client choosing between protobuf.reliable.webpubsub.azure.v1 or protobuf.webpubsub.azure.v1 after referencing the library.
var client = new WebPubSubClient(new Uri("<client-access-uri>"), new WebPubSubClientOptions
{
Protocol = new WebPubSubProtobufReliableProtocol()
});
var client = new WebPubSubClient(new Uri("<client-access-uri>"), new WebPubSubClientOptions
{
Protocol = new WebPubSubProtobufProtocol()
});
// Send message to group "testGroup"
await client.SendToGroupAsync("testGroup", BinaryData.FromString("hello world"), WebPubSubDataType.Text);
// Send custom event to server
await client.SendEventAsync("testEvent", BinaryData.FromString("hello world"), WebPubSubDataType.Text);
You can see other examples at the project repository.