Home | History | Annotate | Download | only in echo
      1 package fi.iki.elonen.samples.echo;
      2 
      3 import fi.iki.elonen.NanoWebSocketServer;
      4 
      5 import java.io.IOException;
      6 
      7 public class EchoSocketSample {
      8     public static void main(String[] args) throws IOException {
      9         final boolean debugMode = args.length >= 2 && args[1].toLowerCase().equals("-d");
     10         NanoWebSocketServer ws = new DebugWebSocketServer(Integer.parseInt(args[0]), debugMode);
     11         ws.start();
     12         System.out.println("Server started, hit Enter to stop.\n");
     13         try {
     14             System.in.read();
     15         } catch (IOException ignored) {
     16         }
     17         ws.stop();
     18         System.out.println("Server stopped.\n");
     19     }
     20 
     21 }
     22 
     23