title: Standalone WebSocket server without JEE/application server
body: <p>I need to implement a fairly simple WebSocket server in Java SE. All it needs to do is accept connections and store the respective sessions, then send a message to all connected client whenever a certain event is fired.</p>
  
  <p>I cannot find a single tutorial for how to do this in regular Java SE. All of them require running with Maven, or deploying it as a WAR - which are all out of the question for this project. I need to run this as a Java SE desktop app.</p>
  
  <p>The tutorials I have found show how to implement an endpoint using annotations like <code>@OnOpen</code>, <code>@OnMessage</code>, and <code>@OnClose</code>. However, none of them explain how to actually initialize the server. I also need to be able to specify a different port number for incoming connections.</p>
  
  <p>Am I missing something? I know people have made chat apps using WebSocket, and that really should not require a web application server. I am not using Maven either, and would prefer to keep it that way for simplicity's sake.</p>