@@ -50,6 +50,7 @@ public class ProxyNodeWebsockets implements BiFunction<String, Consumer<Message>
50
50
Optional <Consumer <Message >>> {
51
51
52
52
private static final UrlTemplate CDP_TEMPLATE = new UrlTemplate ("/session/{sessionId}/se/cdp" );
53
+ private static final UrlTemplate BIDI_TEMPLATE = new UrlTemplate ("/session/{sessionId}/se/bidi" );
53
54
private static final UrlTemplate FWD_TEMPLATE = new UrlTemplate ("/session/{sessionId}/se/fwd" );
54
55
private static final UrlTemplate VNC_TEMPLATE = new UrlTemplate ("/session/{sessionId}/se/vnc" );
55
56
private static final Logger LOG = Logger .getLogger (ProxyNodeWebsockets .class .getName ());
@@ -70,13 +71,14 @@ public ProxyNodeWebsockets(HttpClient.Factory clientFactory, Node node) {
70
71
public Optional <Consumer <Message >> apply (String uri , Consumer <Message > downstream ) {
71
72
UrlTemplate .Match fwdMatch = FWD_TEMPLATE .match (uri );
72
73
UrlTemplate .Match cdpMatch = CDP_TEMPLATE .match (uri );
74
+ UrlTemplate .Match bidiMatch = BIDI_TEMPLATE .match (uri );
73
75
UrlTemplate .Match vncMatch = VNC_TEMPLATE .match (uri );
74
76
75
77
if (cdpMatch == null && vncMatch == null && fwdMatch == null ) {
76
78
return Optional .empty ();
77
79
}
78
80
79
- String sessionId = Stream .of (fwdMatch , cdpMatch , vncMatch )
81
+ String sessionId = Stream .of (fwdMatch , cdpMatch , bidiMatch , vncMatch )
80
82
.filter (Objects ::nonNull )
81
83
.findFirst ()
82
84
.get ()
@@ -95,6 +97,10 @@ public Optional<Consumer<Message>> apply(String uri, Consumer<Message> downstrea
95
97
Capabilities caps = session .getCapabilities ();
96
98
LOG .fine ("Scanning for endpoint: " + caps );
97
99
100
+ if (bidiMatch != null ) {
101
+ return findBiDiEndpoint (downstream , caps );
102
+ }
103
+
98
104
if (vncMatch != null ) {
99
105
return findVncEndpoint (downstream , caps );
100
106
}
@@ -125,6 +131,16 @@ private Optional<Consumer<Message>> findCdpEndpoint(Consumer<Message> downstream
125
131
return Optional .empty ();
126
132
}
127
133
134
+ private Optional <Consumer <Message >> findBiDiEndpoint (Consumer <Message > downstream , Capabilities caps ) {
135
+ try {
136
+ URI uri = new URI (String .valueOf (caps .getCapability ("webSocketUrl" )));
137
+ return Optional .of (uri ).map (bidi -> createWsEndPoint (bidi , downstream ));
138
+ } catch (URISyntaxException e ) {
139
+ LOG .warning ("Unable to create URI from: " + caps .getCapability ("" ));
140
+ return Optional .empty ();
141
+ }
142
+ }
143
+
128
144
private Optional <Consumer <Message >> findForwardCdpEndpoint (Consumer <Message > downstream ,
129
145
Capabilities caps ) {
130
146
// When using Dynamic Grid, we need to connect to a container before using the debuggerAddress
0 commit comments