class Selenium::WebDriver::WebSocketConnection

def callback_thread(params)

def callback_thread(params)
  Thread.new do
    Thread.current.abort_on_exception = true
    # We might end up blocked forever when we have an error in event.
    # For example, if network interception event raises error,
    # the browser will keep waiting for the request to be proceeded
    # before returning back to the original thread. In this case,
    # we should at least print the error.
    Thread.current.report_on_exception = true
    yield params
  rescue *CONNECTION_ERRORS
    Thread.stop
  end
end