(Object url2)
| 1634 | // ─── WebSocket Bridge (matches C# Exchange.WsBridge.cs) ─── |
| 1635 | |
| 1636 | @SuppressWarnings("unchecked") |
| 1637 | public Client client(Object url2) { |
| 1638 | String url = url2.toString(); |
| 1639 | return ((java.util.concurrent.ConcurrentHashMap<String, Client>) this.clients) |
| 1640 | .computeIfAbsent(url, u -> { |
| 1641 | Object ws = this.safeValue(this.options, "ws", new java.util.HashMap<String, Object>()); |
| 1642 | Object wsOptions = this.safeValue(ws, "options", new java.util.HashMap<String, Object>()); |
| 1643 | long keepAlive = 30000; |
| 1644 | Object keepAliveObj = this.safeValue(wsOptions, "keepAlive", null); |
| 1645 | if (keepAliveObj instanceof Number n) keepAlive = n.longValue(); |
| 1646 | boolean decompressBin = true; |
| 1647 | Object decompressObj = this.safeValue(this.options, "decompressBinary", null); |
| 1648 | if (decompressObj instanceof Boolean b) decompressBin = b; |
| 1649 | |
| 1650 | var result = this.checkWsProxySettings(); |
| 1651 | String proxy = null; |
| 1652 | if (result instanceof java.util.List<?> proxies) { |
| 1653 | for (Object p : proxies) { |
| 1654 | if (p != null) { proxy = p.toString(); break; } |
| 1655 | } |
| 1656 | } |
| 1657 | |
| 1658 | Client created = new Client(u, proxy, |
| 1659 | (client, msg) -> this.handleMessage((Client) client, msg), |
| 1660 | (client) -> this.ping((Client) client), |
| 1661 | (client, err) -> this.onClose((Client) client, err), |
| 1662 | (client, err) -> this.onError((Client) client, err), |
| 1663 | this.verbose, keepAlive, decompressBin, |
| 1664 | this.validateServerSsl); |
| 1665 | |
| 1666 | // Forward options.ws.options.headers to the upgrade request — required |
| 1667 | // by exchanges that gate on User-Agent (weex) or send custom headers. |
| 1668 | Object headers = this.safeValue(wsOptions, "headers", null); |
| 1669 | if (headers instanceof java.util.Map<?, ?> m) { |
| 1670 | java.util.Map<String, String> hh = new java.util.HashMap<>(); |
| 1671 | for (java.util.Map.Entry<?, ?> e : m.entrySet()) { |
| 1672 | if (e.getKey() == null || e.getValue() == null) continue; |
| 1673 | hh.put(e.getKey().toString(), e.getValue().toString()); |
| 1674 | } |
| 1675 | if (!hh.isEmpty()) { |
| 1676 | created.handshakeHeaders = hh; |
| 1677 | } |
| 1678 | } |
| 1679 | |
| 1680 | return created; |
| 1681 | }); |
| 1682 | } |
| 1683 | |
| 1684 | public CompletableFuture<Object> watch(Object url, Object messageHash2, Object message, Object subscribeHash2, Object subscription) { |
| 1685 | String messageHash = messageHash2.toString(); |
no test coverage detected