Skip to content

Commit

Permalink
Update PR 1c-syntax#2567
Browse files Browse the repository at this point in the history
  • Loading branch information
salexdv authored and nixel2007 committed Oct 26, 2022
1 parent 5e75287 commit 0767c55
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
aliases = {"-w", "--websocket"},
description = "Websocket server mode",
usageHelpAutoWidth = true,
footer = "@|green Copyright(c) 2018-2020|@")
footer = "@|green Copyright(c) 2018-2022|@")
@Component
@RequiredArgsConstructor
public class WebsocketStartCommand implements Callable<Integer> {
Expand All @@ -75,6 +75,13 @@ public class WebsocketStartCommand implements Callable<Integer> {
defaultValue = "")
private String configurationOption;

@Option(
names = {"--host"},
description = "Hostname to open websocket",
paramLabel = "<host>",
defaultValue = "localhost")
private String websocketHost;

@Option(
names = {"-p", "--port"},
description = "Listening port",
Expand All @@ -92,7 +99,7 @@ public Integer call() {
configuration.update(configurationFile);
}

launcher.runWebSocketServer(websocketPort);
launcher.runWebSocketServer(websocketHost, websocketPort);
return -1;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ public class WebSocketRunner {

private final LanguageServerConfiguration configuration;

public void runWebSocketServer(int port) {
public void runWebSocketServer(String hostname, int port) {

String hostname = "localhost";
String contextPath = "/";
Server server = new Server(hostname, port, contextPath, null, BSLLSWebSocketServerConfigProvider.class);
var server = new Server(hostname, port, contextPath, null, BSLLSWebSocketServerConfigProvider.class);
Runtime.getRuntime().addShutdownHook(new Thread(server::stop, "bsl-websocket-server-shutdown-hook"));

try {
Expand Down

0 comments on commit 0767c55

Please sign in to comment.