diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/CHANGELOG.md b/sdk/webpubsub/Azure.Messaging.WebPubSub/CHANGELOG.md index 7c6c0428f3a34..2c9855e12ec0a 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/CHANGELOG.md +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/CHANGELOG.md @@ -3,6 +3,7 @@ ## 1.5.0-beta.1 (Unreleased) ### Features Added +- Added support for SocketIO when generating ClientAccessURI ### Breaking Changes diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/api/Azure.Messaging.WebPubSub.netstandard2.0.cs b/sdk/webpubsub/Azure.Messaging.WebPubSub/api/Azure.Messaging.WebPubSub.netstandard2.0.cs index bd877b6c98a49..b25c8a36916ff 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/api/Azure.Messaging.WebPubSub.netstandard2.0.cs +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/api/Azure.Messaging.WebPubSub.netstandard2.0.cs @@ -9,6 +9,7 @@ public enum WebPubSubClientProtocol { Default = 0, Mqtt = 1, + SocketIO = 2, } public enum WebPubSubPermission { diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/WebPubSubClientProtocol.cs b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/WebPubSubClientProtocol.cs index ea59d637dc07b..6156a9af1a329 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/WebPubSubClientProtocol.cs +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/WebPubSubClientProtocol.cs @@ -17,4 +17,9 @@ public enum WebPubSubClientProtocol /// MQTT client protocol, whose access endpoint starts with "/clients/mqtt". /// Mqtt, + + /// + /// SocketIO client protocol, whose access endpoint starts with "/clients/socketio". + /// + SocketIO, } diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/WebPubSubServiceClient_helpers.cs b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/WebPubSubServiceClient_helpers.cs index dcaef57f024fb..66752a1f007ee 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/WebPubSubServiceClient_helpers.cs +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/WebPubSubServiceClient_helpers.cs @@ -387,6 +387,7 @@ private string GenerateTokenFromAzureKeyCredential(DateTimeOffset expiresAt, Web { WebPubSubClientProtocol.Default => $"client/hubs/{_hub}", WebPubSubClientProtocol.Mqtt => $"clients/mqtt/hubs/{_hub}", + WebPubSubClientProtocol.SocketIO => $"clients/socketio/hubs/{_hub}", _ => throw new ArgumentOutOfRangeException(nameof(clientProtocol)) }; @@ -407,6 +408,7 @@ private async Task GetClientAccessTokenCore( { WebPubSubClientProtocol.Default => "default", WebPubSubClientProtocol.Mqtt => "mqtt", + WebPubSubClientProtocol.SocketIO => "socketio", _ => throw new ArgumentOutOfRangeException(nameof(clientAccess)) }; if (_tokenCredential != null) diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/tests/WebPubSubGenerateUriTests.cs b/sdk/webpubsub/Azure.Messaging.WebPubSub/tests/WebPubSubGenerateUriTests.cs index ad7a43a3fa3a1..940b57f59b716 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/tests/WebPubSubGenerateUriTests.cs +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/tests/WebPubSubGenerateUriTests.cs @@ -24,6 +24,7 @@ public class WebPubSubGenerateUriTests [TestCase(WebPubSubClientProtocol.Default, "/client")] [TestCase(WebPubSubClientProtocol.Mqtt, "/clients/mqtt")] + [TestCase(WebPubSubClientProtocol.SocketIO, "/clients/socketio")] public async Task GetClientAccessUri_AccessKey_Test(WebPubSubClientProtocol clientType, string clientUriPrefix) { var serviceClient = new WebPubSubServiceClient(string.Format("Endpoint=http://localhost;Port=8080;AccessKey={0};Version=1.0;", FakeAccessKey), "hub"); @@ -38,6 +39,7 @@ public async Task GetClientAccessUri_AccessKey_Test(WebPubSubClientProtocol clie [TestCase(WebPubSubClientProtocol.Default, "/client", "default")] [TestCase(WebPubSubClientProtocol.Mqtt, "/clients/mqtt", "mqtt")] + [TestCase(WebPubSubClientProtocol.SocketIO, "/clients/socketio", "socketio")] public async Task GetClientAccessUri_MicrosoftEntraId_DefaultClient_Test(WebPubSubClientProtocol clientType, string clientUriPrefix, string clientTypeString) { var serviceClient = new WebPubSubServiceSubClass(new Uri("https://localhost"), "hub", new DefaultAzureCredential());