[network] update
This commit is contained in:
@@ -21,13 +21,13 @@ class JsConnection<O:Message, I:Message> extends BaseConnection<O, I> {
|
||||
this.port = port;
|
||||
connected = false;
|
||||
}
|
||||
|
||||
public static function isSecured():Bool {
|
||||
return Browser.location.protocol == "https";
|
||||
}
|
||||
|
||||
private function buildSocket(host:String, port:Int):WebSocket {
|
||||
var protocol = switch Browser.location.protocol {
|
||||
case 'http:': 'ws:';
|
||||
case 'https:': 'wss:';
|
||||
case _: 'ws:';
|
||||
}
|
||||
var protocol = isSecured() ? "wss:" : "ws:";
|
||||
return new WebSocket('$protocol//$host:$port');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user