private synchronized void addWebSocketHandler(String path, WebSocketHandlerWrapper handlerWrapper) {
        if (initialized) {
            throwBeforeRouteMappingException();
        }
        if (isRunningFromServlet()) {
            throw new IllegalStateException("WebSockets are only supported in the embedded server");
        }
        requireNonNull(path, "WebSocket path cannot be null");
        if (webSocketHandlers == null) {
            webSocketHandlers = new HashMap<>();
        }

        webSocketHandlers.put(path, handlerWrapper);
    }
Maps the given path to the given WebSocket handler instance.
<p>
This is currently only available in the embedded server mode.

@param path    the WebSocket path.
@param handler the handler instance that will manage the WebSocket connection to the given path.
src/main/java/spark/Service.java