Module: OpenAI::WebSocket::GuardedConnection Private

Included in:
TypedConnection
Defined in:
lib/openai/helpers/websocket/connection.rb

Overview

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

Retire failed sockets and uncertain writes without changing the raw connection contract.

Instance Method Summary collapse

Instance Method Details

#abort ⇒ Object

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.



21
22
23
24
25
26
27
28
# File 'lib/openai/helpers/websocket/connection.rb', line 21

def abort
  super
  @closed = true
  nil
rescue StandardError
  @poisoned = true
  raise transport_error, cause: nil
end

#close(code: 1000, reason: "") ⇒ Object

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.



11
12
13
14
15
16
17
18
# File 'lib/openai/helpers/websocket/connection.rb', line 11

def close(code: 1000, reason: "")
  @poisoned || @closed ? abort : super
  @closed = true
  nil
rescue StandardError
  @poisoned = true
  raise transport_error, cause: nil
end

#closed? ⇒ Boolean

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:



9
# File 'lib/openai/helpers/websocket/connection.rb', line 9

def closed? = @poisoned || @closed || super