Skip to content

Commit 1bb0be0

Browse files
authored
add socketio support when generating client access uri (Azure#46942)
* add socketio support when generating client access uri * add changelog * update api --------- Co-authored-by: tomnguyen <[email protected]>
1 parent 52190ed commit 1bb0be0

File tree

5 files changed

+11
-0
lines changed

5 files changed

+11
-0
lines changed

sdk/webpubsub/Azure.Messaging.WebPubSub/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 1.5.0-beta.1 (Unreleased)
44

55
### Features Added
6+
- Added support for SocketIO when generating ClientAccessURI
67

78
### Breaking Changes
89

sdk/webpubsub/Azure.Messaging.WebPubSub/api/Azure.Messaging.WebPubSub.netstandard2.0.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public enum WebPubSubClientProtocol
99
{
1010
Default = 0,
1111
Mqtt = 1,
12+
SocketIO = 2,
1213
}
1314
public enum WebPubSubPermission
1415
{

sdk/webpubsub/Azure.Messaging.WebPubSub/src/WebPubSubClientProtocol.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@ public enum WebPubSubClientProtocol
1717
/// MQTT client protocol, whose access endpoint starts with "/clients/mqtt".
1818
/// </summary>
1919
Mqtt,
20+
21+
/// <summary>
22+
/// SocketIO client protocol, whose access endpoint starts with "/clients/socketio".
23+
/// </summary>
24+
SocketIO,
2025
}

sdk/webpubsub/Azure.Messaging.WebPubSub/src/WebPubSubServiceClient_helpers.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ private string GenerateTokenFromAzureKeyCredential(DateTimeOffset expiresAt, Web
387387
{
388388
WebPubSubClientProtocol.Default => $"client/hubs/{_hub}",
389389
WebPubSubClientProtocol.Mqtt => $"clients/mqtt/hubs/{_hub}",
390+
WebPubSubClientProtocol.SocketIO => $"clients/socketio/hubs/{_hub}",
390391
_ => throw new ArgumentOutOfRangeException(nameof(clientProtocol))
391392
};
392393

@@ -407,6 +408,7 @@ private async Task<string> GetClientAccessTokenCore(
407408
{
408409
WebPubSubClientProtocol.Default => "default",
409410
WebPubSubClientProtocol.Mqtt => "mqtt",
411+
WebPubSubClientProtocol.SocketIO => "socketio",
410412
_ => throw new ArgumentOutOfRangeException(nameof(clientAccess))
411413
};
412414
if (_tokenCredential != null)

sdk/webpubsub/Azure.Messaging.WebPubSub/tests/WebPubSubGenerateUriTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class WebPubSubGenerateUriTests
2424

2525
[TestCase(WebPubSubClientProtocol.Default, "/client")]
2626
[TestCase(WebPubSubClientProtocol.Mqtt, "/clients/mqtt")]
27+
[TestCase(WebPubSubClientProtocol.SocketIO, "/clients/socketio")]
2728
public async Task GetClientAccessUri_AccessKey_Test(WebPubSubClientProtocol clientType, string clientUriPrefix)
2829
{
2930
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
3839

3940
[TestCase(WebPubSubClientProtocol.Default, "/client", "default")]
4041
[TestCase(WebPubSubClientProtocol.Mqtt, "/clients/mqtt", "mqtt")]
42+
[TestCase(WebPubSubClientProtocol.SocketIO, "/clients/socketio", "socketio")]
4143
public async Task GetClientAccessUri_MicrosoftEntraId_DefaultClient_Test(WebPubSubClientProtocol clientType, string clientUriPrefix, string clientTypeString)
4244
{
4345
var serviceClient = new WebPubSubServiceSubClass(new Uri("https://localhost"), "hub", new DefaultAzureCredential());

0 commit comments

Comments
 (0)