# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.


module Selenium
  module WebDriver
    class WebSocketConnection
      include WebSocket

      @callback_threads: untyped

      @protocol: Symbol?

      @session_id: untyped

      @url: untyped

      @socket_thread: untyped

      @callbacks: untyped

      @messages: untyped

      @incoming_frame: untyped

      @wait: untyped

      @socket: untyped

      @ws: untyped

      @id: untyped

      CONNECTION_ERRORS: Array[untyped]

      RESPONSE_WAIT_TIMEOUT: Integer

      RESPONSE_WAIT_INTERVAL: Float

      MAX_LOG_MESSAGE_SIZE: Integer

      def initialize: (url: String) -> void

      def add_callback: (untyped event) { () -> void } -> Integer

      def close: () -> untyped

      def callbacks: () -> untyped

      def remove_callback: (untyped event, untyped id) -> untyped

      def send_cmd: (**untyped payload) -> untyped

      private

      def bidi?: -> bool

      def devtools?: -> bool

      def messages: () -> untyped

      def process_handshake: () -> untyped

      def attach_socket_listener: () -> untyped

      def incoming_frame: () -> untyped

      def process_frame: (untyped frame) -> (Hash[untyped, untyped] | untyped)

      def callback_thread: (untyped params) { (untyped) -> untyped } -> untyped

      def wait: () -> untyped

      def socket: () -> untyped

      def ws: () -> untyped

      def next_id: () -> untyped
    end
  end
end
