title: MQTTnet Server using Websockets and TCP simultaneously
body: <p>I am working on a MQTT Server solution using <strong>MQTTnet</strong> and <strong>MQTTnet.ASPNetCore</strong> .NET libraries. I need the server to provide a Websockets endpoint so that I can interact with it from a JavaScript application.</p>
  
  <p>I have tested both using a regular <strong>TCP-based server</strong> as a console application and a <strong>Websockets-based server</strong> as a APS.Net Core 2.0 application. Both applications work fine, and I can connect to them from an MQTT client using TCP and Websockets respectively.</p>
  
  <p>I was wondering if it would be possible to implement both <strong>TCP and Websockets endpoints simultaneously</strong>, so that I can connect TCP clients and Websockets clients that can share the topics and exchange messages.</p>
  
  <p>I have tried adding some configuration options used by the TCP server when I create the Hosted Mqtt Server of the ASP.Net application:</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      var mqttServerOptions = new MqttServerOptionsBuilder()
          .WithConnectionBacklog(100)
          .WithDefaultEndpoint()
          .WithDefaultEndpointPort(1883)
          .Build();
  
      services.AddHostedMqttServer(mqttServerOptions);
  }
  </code></pre>
  
  <p>However, this doesn't seem to work, as I can reach the Websockets endpoint but not the TCP one.</p>
  
  <p>Any suggestion on this?</p>