Skip to content

Commit

Permalink
allow specifying the websocket protocol in the host config
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellpeck committed Oct 2, 2024
1 parent bd8d0ea commit 616964f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/flowr/server-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,16 @@ export class FlowrServerSession implements FlowrSession {
}

private connect(configType: ConnectionType, typeToUse: ConnectionType): void {
const host = getConfig().get<string>(Settings.ServerHost, 'localhost')
let host = getConfig().get<string>(Settings.ServerHost, 'localhost')
const port = getConfig().get<number>(Settings.ServerPort, 1042)
// we also set configType when overriding the type to use because that's the only one we want to try even in auto mode!
if(host.startsWith('ws://')){
host = host.substring(5)
configType = typeToUse = 'websocket'
} else if(host.startsWith('wss://')){
host = host.substring(6)
configType = typeToUse = 'websocket-secure'
}
this.outputChannel.appendLine(`Connecting to flowR server using ${typeToUse} at ${host}:${port}`)
// if the type is auto, we still start with a (secure!) websocket connection first
this.connection = isWeb() ? new BrowserWsConnection(typeToUse !== 'websocket') : typeToUse == 'tcp' ? new TcpConnection() : new WsConnection(typeToUse !== 'websocket')
Expand Down

0 comments on commit 616964f

Please sign in to comment.