File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
test-app/app/src/main/java/com/tns Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -231,9 +231,22 @@ protected Response serveHttp(IHTTPSession session) {
231
231
return super .serveHttp (session );
232
232
}
233
233
234
+ private JsV8InspectorWebSocket webSocket ;
235
+
234
236
@ Override
235
237
protected WebSocket openWebSocket (IHTTPSession handshake ) {
236
- return new JsV8InspectorWebSocket (handshake , currentRuntimeLogger );
238
+ // close the previous webSocket
239
+ if (this .webSocket != null ) {
240
+ try {
241
+ this .webSocket .close (WebSocketFrame .CloseCode .NormalClosure , "New browser connection is open" , false );
242
+ } catch (IOException ioException ) {
243
+ if (this .webSocket .getState () != State .CLOSED ) {
244
+ Log .e ("{N}.v8-inspector" , "Error closing previous connection" , ioException );
245
+ }
246
+ }
247
+ }
248
+ this .webSocket = new JsV8InspectorWebSocket (handshake );
249
+ return this .webSocket ;
237
250
}
238
251
}
239
252
You can’t perform that action at this time.
0 commit comments