websocket-sharp icon indicating copy to clipboard operation
websocket-sharp copied to clipboard

`wssv.Stop()` Never Stops

Open chaojian-zhang opened this issue 1 year ago • 0 comments

Per README for server code:

using System;
using WebSocketSharp;
using WebSocketSharp.Server;

namespace Example
{
  public class Laputa : WebSocketBehavior
  {
    protected override void OnMessage (MessageEventArgs e)
    {
      var msg = e.Data == "BALUS"
                ? "Are you kidding?"
                : "I'm not available now.";

      Send (msg);
    }
  }

  public class Program
  {
    public static void Main (string[] args)
    {
      var wssv = new WebSocketServer ("ws://dragonsnest.far");

      wssv.AddWebSocketService<Laputa> ("/Laputa");
      wssv.Start ();
      Console.ReadKey (true);
      wssv.Stop ();
    }
  }
}

If you actually run it, the server never stops after the last call.

chaojian-zhang avatar May 20 '24 02:05 chaojian-zhang