Class: OpenAI::Responses::Transports::AsyncWebSocket Private

Inherits:
WebSocket::AsyncWebSocketTransport show all
Defined in:
lib/openai/helpers/responses_websocket/transports/async_websocket.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Responses facade for the shared optional async WebSocket transport.

Instance Method Summary collapse

Methods inherited from WebSocket::AsyncWebSocketTransport

#open

Constructor Details

#initialize ⇒ AsyncWebSocket

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of AsyncWebSocket.



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/openai/helpers/responses_websocket/transports/async_websocket.rb', line 161

def initialize
  error_factory = lambda do |url:, message: nil, http_status: nil, **_options|
    OpenAI::Errors::ResponsesConnectionError.new(
      url: url,
      message: message,
      http_status: http_status
    )
  end

  super(
    product_name: "Responses",
    error_class: OpenAI::Errors::ResponsesConnectionError,
    error_factory: error_factory,
    dependency_message: "Responses WebSockets require the async-websocket gem. Add it to your Gemfile."
  )
end