Browse Source

Pull request #5663: REPORT-55048 websocket使用代理的情况再处理下

Merge in DESIGN/design from ~HADES/design:final/10.0 to final/10.0

* commit 'bc0aee15e1948b6fc6ce395cd54c70fcb2c1547e':
  REPORT-55048 websocket使用代理的情况处理下
final/10.0
Hades 3 years ago
parent
commit
9afebaa410
  1. 6
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

6
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -156,11 +156,15 @@ public class DesignerSocketIO {
private static String[] getSocketUri() throws IOException { private static String[] getSocketUri() throws IOException {
Workspace current = WorkContext.getCurrent(); Workspace current = WorkContext.getCurrent();
URL url = new URL(current.getPath()); URL url = new URL(current.getPath());
Integer[] ports = current.get(SocketInfoOperator.class).getPort(); Integer[] ports = WebSocketConfig.getInstance().getAvailablePorts();
WorkspaceConnection connection = current.getConnection(); WorkspaceConnection connection = current.getConnection();
// 服务器配置https webSocket可能是wss也可能是ws webSocket的协议可以单独配置 // 服务器配置https webSocket可能是wss也可能是ws webSocket的协议可以单独配置
WebSocketProtocol webSocketProtocol = WebSocketConfig.getInstance().getProtocol(); WebSocketProtocol webSocketProtocol = WebSocketConfig.getInstance().getProtocol();
currentProtocol = webSocketProtocol == WebSocketProtocol.PLAIN ? HTTP : HTTPS; currentProtocol = webSocketProtocol == WebSocketProtocol.PLAIN ? HTTP : HTTPS;
if (WebSocketConfig.getInstance().isUsingProxy()) {
// 如果配置了代理服务器跟随服务器协议
currentProtocol = url.getProtocol();
}
String[] result = new String[ports.length]; String[] result = new String[ports.length];
for (int i = 0; i < ports.length; i++) { for (int i = 0; i < ports.length; i++) {
result[i] = String.format("%s://%s:%s%s?%s=%s&%s=%s", result[i] = String.format("%s://%s:%s%s?%s=%s&%s=%s",

Loading…
Cancel
Save