Merge pull request #355 from JanEggers/ConnectionHandlerWithWebsockets

Connection handler with websockets
This commit is contained in:
Christian
2018-07-07 21:00:32 +02:00
committed by GitHub
3 changed files with 26 additions and 6 deletions
+7 -2
View File
@@ -22,13 +22,18 @@ namespace MQTTnet.TestApp.AspNetCore2
.Build();
services
.AddHostedMqttServer(mqttServerOptions)
.AddMqttConnectionHandler();
.AddMqttConnectionHandler()
.AddConnections();
}
// In class _Startup_ of the ASP.NET Core 2.0 project.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseMqttEndpoint();
app.UseConnections(c => c.MapConnectionHandler<MqttConnectionHandler>("/mqtt", options => {
options.WebSockets.SubProtocolSelector = MQTTnet.AspNetCore.ApplicationBuilderExtensions.SelectSubProtocol;
}));
//app.UseMqttEndpoint();
app.UseMqttServer(server =>
{
server.Started += async (sender, args) =>