aboutsummaryrefslogtreecommitdiff
path: root/websocket/src/main/java/fi/iki/elonen/samples/echo/EchoSocketSample.java
blob: b28a42c6cdf46dbb69d73f29fd194d06d582798f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package fi.iki.elonen.samples.echo;

import fi.iki.elonen.NanoWebSocketServer;

import java.io.IOException;

public class EchoSocketSample {
    public static void main(String[] args) throws IOException {
        final boolean debugMode = args.length >= 2 && args[1].toLowerCase().equals("-d");
        NanoWebSocketServer ws = new DebugWebSocketServer(Integer.parseInt(args[0]), debugMode);
        ws.start();
        System.out.println("Server started, hit Enter to stop.\n");
        try {
            System.in.read();
        } catch (IOException ignored) {
        }
        ws.stop();
        System.out.println("Server stopped.\n");
    }

}