Add OWIN-hosted REST API for proxy connection management#6
Open
mvsnak wants to merge 12 commits into
Open
Conversation
… local config creation
…nnectionString override
There was a problem hiding this comment.
Pull request overview
This PR embeds a self-hosted OWIN/Web API 2 HTTP server into the StreamSplitter Windows service to enable REST-based management of proxy connections (including Swagger UI), and updates the Manager + WiX installer to support the new runtime dependencies and configuration refresh behavior.
Changes:
- Add OWIN self-host + Web API controllers/models (with Swagger) to expose CRUD/status operations for proxy connections.
- Extend
ServiceHostwith web-host startup/shutdown plus helper APIs to add/remove connections and query runtime status. - Update installer/project/configuration to ship required assemblies and enable Manager auto-refresh when the service signals configuration changes.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| Source/Applications/StreamSplitterSetup/StreamSplitterSetup.wxs | Adds a WiX component group to deploy OWIN/Web API/Swagger + JSON dependencies. |
| Source/Applications/StreamSplitterSetup/StreamSplitterSetup.wixproj | Adjusts WiX targets path resolution for newer MSBuild/VS installs. |
| Source/Applications/StreamSplitterManager/StreamSplitterManager.cs | Auto-triggers DownloadConfig when the service broadcasts the API config-changed marker. |
| Source/Applications/StreamSplitter/StreamSplitter.csproj | Adds Web API source files + references and enables XML doc output for Swagger. |
| Source/Applications/StreamSplitter/ServiceHost.cs | Starts/stops the OWIN host and adds connection add/remove + status helpers for the API. |
| Source/Applications/StreamSplitter/packages.config | Introduces NuGet dependencies needed for Web API + Swashbuckle + JSON. |
| Source/Applications/StreamSplitter/app.config | Adds system settings for web hosting + binding redirects needed by new deps. |
| Source/Applications/StreamSplitter/Api/Startup.cs | Configures Web API routing/formatters and Swashbuckle Swagger UI. |
| Source/Applications/StreamSplitter/Api/Models/UpdateConnectionRequest.cs | DTO for PATCH partial updates. |
| Source/Applications/StreamSplitter/Api/Models/CreateConnectionRequest.cs | DTO for creating connections from a GSF connection string. |
| Source/Applications/StreamSplitter/Api/Models/ConnectionStatusDto.cs | DTO for runtime status/metrics returned by /status. |
| Source/Applications/StreamSplitter/Api/Models/ConnectionDto.cs | DTO for returning configured connections + runtime state. |
| Source/Applications/StreamSplitter/Api/Filters/FileUploadOperationFilter.cs | Swagger operation filter to show file upload UI for /import. |
| Source/Applications/StreamSplitter/Api/Controllers/ConnectionsController.cs | Implements the REST API endpoints for list/get/create/import/patch/status/delete. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+83
to
+85
| ConnectionDto[] dtos = configuration | ||
| .Select(c => ConnectionDto.FromProxyConnection(c, ServiceHost.Current.GetRuntimeConnectionState(c.ID))) | ||
| .ToArray(); |
Comment on lines
+170
to
+173
| [HttpPost, Route("")] | ||
| [ResponseType(typeof(ConnectionDto[]))] | ||
| public IHttpActionResult CreateConnections([FromBody] CreateConnectionRequest[] requests) | ||
| { |
Comment on lines
+392
to
+404
| CategorizedSettingsElementCollection systemSettings = | ||
| ConfigurationFile.Current.Settings["systemSettings"]; | ||
|
|
||
| if (!systemSettings["WebHostingEnabled"].ValueAs(DefaultWebHostingEnabled)) | ||
| { | ||
| DisplayStatusMessage("Web API hosting is disabled per configuration.", UpdateType.Information); | ||
| return; | ||
| } | ||
|
|
||
| string webHostURL = systemSettings["WebHostURL"].ValueAs(DefaultWebHostURL); | ||
|
|
||
| m_webAppHost = WebApp.Start<Startup>(webHostURL); | ||
|
|
Comment on lines
+280
to
+282
| MultipartMemoryStreamProvider provider = new MultipartMemoryStreamProvider(); | ||
| await Request.Content.ReadAsMultipartAsync(provider); | ||
|
|
Comment on lines
+439
to
+441
| if (request.Enabled.HasValue) | ||
| settings["enabled"] = request.Enabled.Value.ToString().ToLower(); | ||
|
|
Comment on lines
+11
to
+13
| <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath> | ||
| <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets') ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath> | ||
| <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath> |
Comment on lines
+21
to
+23
| // 06/05/2026 - Marcos Vinicius Snak | ||
| // ApplyStreamProxyStatusUpdates: detect connections added externally (e.g. via REST API) | ||
| // and trigger automatic DownloadConfig so the Manager list stays in sync. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Embeds a self-hosted OWIN/Web API 2 server inside
ServiceHost, listening onhttp://localhost:8283by default (configurable viaapp.config).Exposes a
ConnectionsControllerwith full CRUD coverage of proxy connections:/api/connections/api/connections/{id}/api/connections/api/connections/import.s3configfile/api/connections/{id}/api/connections/{id}/status/api/connections/{id}StreamProxyshutdownSwagger UI available at
http://localhost:8283(powered by Swashbuckle + XML docs).All write operations broadcast an
[API_CONFIG_CHANGED]message over the GSF remoting channel so that any connectedStreamSplitterManagerinstance reloads its view.Updates
StreamSplitterSetup(WiX) with OWIN/Web API dependency components and fixes WiX targets path resolution for Visual Studio 2022+ (MSBuild v17/v18).Configuration
New entries added to
app.configunder<systemSettings>:WebHostingEnabledTrueWebHostURLhttp://localhost:8283AuthenticationSchemesAnonymousAnonymousResourceExpression^/api/New dependencies
Test plan
GET http://localhost:8283/api/connectionsreturns[]when no connections are configured.http://localhost:8283; all 7 endpoints are listed with correct schemas.POST /api/connectionscreates a connection; a connectedStreamSplitterManagerreloads automatically.DELETE /api/connections/{id}removes the connection;StreamSplitterManagerdoes not restore it on the next refresh.GET /api/connections/{id}/statusreturns frame counts and latency for a runningStreamProxy.PATCH /api/connections/{id}with{ "enabled": false }disables only the targeted connection.WebHostingEnabled=Falseinapp.config; service starts normally without binding a port.StreamSplitterSetupin Release|x64 and Release|x86; MSIs install and register the Windows service correctly.