diff --git a/samples/SocketModeBot/Program.cs b/samples/SocketModeBot/Program.cs index fc4850d7..032137a5 100644 --- a/samples/SocketModeBot/Program.cs +++ b/samples/SocketModeBot/Program.cs @@ -9,17 +9,13 @@ // Socket Mode receives activities over an outbound WebSocket, so the bot runs on a // generic host with no web server and no public messaging endpoint. +// Socket Mode is currently only available for new bots. HostApplicationBuilder builder = Host.CreateApplicationBuilder(new HostApplicationBuilderSettings { Args = args, ContentRootPath = AppContext.BaseDirectory, }); -builder.Services.AddTeamsBotApplication(options => options.UseSocketMode(socket => -{ - // Socket Mode is only available on the Canary and Pilot1 rings for now. - // Pilot1 (https://pilot1.botapi.skype.com) is supported as well. - socket.NegotiateBaseUrl = new Uri("https://canary.botapi.skype.com"); -})); +builder.Services.AddTeamsBotApplication(options => options.UseSocketMode()); using IHost host = builder.Build(); TeamsBotApplication teamsApp = host.UseTeamsBotApplication(); diff --git a/samples/SocketModeBot/README.md b/samples/SocketModeBot/README.md index 40689618..2f024ae8 100644 --- a/samples/SocketModeBot/README.md +++ b/samples/SocketModeBot/README.md @@ -9,7 +9,8 @@ This sample is an echo bot that receives activities over Socket Mode instead of ## What it shows -- `UseSocketMode(...)` on `AddTeamsBotApplication` to receive activities over Socket Mode, with `NegotiateBaseUrl` set to the canary ring. Socket Mode is currently only available on the Canary (`https://canary.botapi.skype.com`) and Pilot1 (`https://pilot1.botapi.skype.com`) rings. +- `UseSocketMode()` on `AddTeamsBotApplication` to receive activities over Socket Mode using the default production endpoint (`https://botapi.skype.com`). +- One connection per geo (`amer`, `emea`, `apac`) by default for inbound coverage across regions. Override with `Geos = [...]` or point at a custom ring with `NegotiateBaseUrl` in the `UseSocketMode(socket => ...)` callback. - `$(NoWarn);ExperimentalTeamsSocketMode` in the project file, because Socket Mode is experimental. - A generic host (`Host.CreateApplicationBuilder`) with no web server, and `UseTeamsBotApplication()` to get the app. - Per-geo `Ready`, `Disconnected`, and `Reconnected` subscriptions in `Program.cs`, plus a status snapshot after startup. diff --git a/src/Microsoft.Teams.Apps/README.md b/src/Microsoft.Teams.Apps/README.md index 32cd586b..2f6c29a6 100644 --- a/src/Microsoft.Teams.Apps/README.md +++ b/src/Microsoft.Teams.Apps/README.md @@ -221,9 +221,6 @@ host.Run(); - **Public cloud only** — Registration fails for bots configured for another cloud. - **Classic bot identity only** — The connection is negotiated with the bot's app ID and credentials. Agentic identities are not supported. -- **Canary and Pilot1 endpoints** — Socket Mode is currently available only on the Canary and Pilot1 rings. Set - `NegotiateBaseUrl` to `https://canary.botapi.skype.com` or `https://pilot1.botapi.skype.com` until it is enabled on - the default production endpoint. - **Rejected credentials are not retried** — If negotiation returns HTTP 401 or 403, startup fails immediately. After startup, the affected geo stops reconnecting until the app restarts. - **Throttling respects the service** — On HTTP 429, the service's `Retry-After` delay takes precedence over diff --git a/src/Microsoft.Teams.Apps/SocketMode/SocketModeOptions.cs b/src/Microsoft.Teams.Apps/SocketMode/SocketModeOptions.cs index d5e16517..afdac15b 100644 --- a/src/Microsoft.Teams.Apps/SocketMode/SocketModeOptions.cs +++ b/src/Microsoft.Teams.Apps/SocketMode/SocketModeOptions.cs @@ -14,19 +14,20 @@ namespace Microsoft.Teams.Apps.SocketMode; /// It is supported only in the public cloud, and runs on a host without a web server /// (Host.CreateApplicationBuilder). Settings are validated when the host starts. /// Socket Mode is experimental: the API is in preview and may change, and it is recommended only for developing agents. +/// Socket Mode is currently only available for new bots. /// [Experimental("ExperimentalTeamsSocketMode")] public sealed class SocketModeOptions { /// /// Gets or sets the base URL used to negotiate each geo connection. Must use HTTPS unless it targets loopback. - /// Defaults to https://botapi.skype.com. + /// Defaults to https://botapi.skype.com. Override this to target a different Teams backend service ring. /// public Uri NegotiateBaseUrl { get; set; } = new(SocketModeProtocol.DefaultNegotiateBaseUrl); /// /// Gets or sets the geos to connect, one connection each. An empty string connects to the base URL without a geo - /// segment. Defaults to amer, emea, and apac. + /// segment. Defaults to amer, emea, and apac. Override this to connect to a different set of geos. /// public IReadOnlyList Geos { get; set; } = SocketModeProtocol.DefaultGeos; diff --git a/src/Microsoft.Teams.Apps/TeamsBotApplicationOptions.cs b/src/Microsoft.Teams.Apps/TeamsBotApplicationOptions.cs index 41d30795..007dc208 100644 --- a/src/Microsoft.Teams.Apps/TeamsBotApplicationOptions.cs +++ b/src/Microsoft.Teams.Apps/TeamsBotApplicationOptions.cs @@ -75,6 +75,7 @@ public TeamsBotApplicationOptions UseState(Action? configure = /// get the app with host.UseTeamsBotApplication(). Passing clears any earlier Socket /// Mode configuration, so the bot receives activities over HTTP. Socket Mode is experimental: the API is in preview /// and may change, and it is recommended only for developing agents. + /// Socket Mode is currently only available for new bots. /// /// Whether to receive activities over Socket Mode. Default is . /// This instance for chaining. @@ -94,6 +95,7 @@ public TeamsBotApplicationOptions UseSocketMode(bool enabled = true) /// Supported only in the public cloud. Build the bot with Host.CreateApplicationBuilder() (no web server) and /// get the app with host.UseTeamsBotApplication(). Socket Mode is experimental: the API is in preview and may /// change, and it is recommended only for developing agents. + /// Socket Mode is currently only available for new bots. /// /// Delegate to configure . /// This instance for chaining.