Class: OpenAI::Live::Connection
- Inherits:
-
WebSocket::TypedConnection
- Object
- WebSocket::Connection
- WebSocket::TypedConnection
- OpenAI::Live::Connection
- Defined in:
- lib/openai/helpers/live/websocket.rb
Overview
A transport-open primary connection. Startup is owned by the caller: send session.start and observe session.started before further commands. Only one receive call may read or decode at a time. Iteration releases the read before yielding an event to the caller.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from WebSocket::TypedConnection
Attributes inherited from WebSocket::Connection
Instance Method Summary collapse
-
#initialize(socket:, url:) ⇒ Connection
constructor
private
A new instance of Connection.
- #receive ⇒ Object
- #receive_raw ⇒ Object private
Methods inherited from WebSocket::TypedConnection
#close, #closed?, #each, #parse_event, #send_event
Methods included from WebSocket::GuardedConnection
Methods inherited from WebSocket::Connection
#abort, #close, #closed?, #each, #send_raw
Constructor Details
#initialize(socket:, url:) ⇒ Connection
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 Connection.
51 52 53 54 55 56 |
# File 'lib/openai/helpers/live/websocket.rb', line 51 def initialize(socket:, url:) super(socket: socket, url: url, client_event: client_event_type, server_event: server_event_type) @poisoned = false @closed = false @read_mutex = Mutex.new end |
Instance Method Details
#receive ⇒ Object
60 61 62 |
# File 'lib/openai/helpers/live/websocket.rb', line 60 def receive with_read_lease { read_one } end |
#receive_raw ⇒ 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.
65 66 67 |
# File 'lib/openai/helpers/live/websocket.rb', line 65 def receive_raw with_read_lease { } end |