public class WebSocketServer {
public static void main(final String[] args) {
Undertow server = Undertow.builder()
.addListener(8080, "localhost")
.addWebSocketHandler("/myapp", new WebSocketSessionHandler() {
@Override
public void onSession(final WebSocketSession session, WebSocketHttpExchange exchange) {
session.setFrameHandler(new AbstractAssembledFrameHandler() {
@Override
public void onTextFrame(final WebSocketSession session, final WebSocketFrameHeader header, final CharSequence payload) {