Class: Believe::Resources::Client::Ws
- Inherits:
-
Object
- Object
- Believe::Resources::Client::Ws
- Defined in:
- lib/believe/resources/client/ws.rb
Overview
WebSocket endpoints for real-time bidirectional communication - Live match simulation
Instance Method Summary collapse
-
#initialize(client:) ⇒ Ws
constructor
private
A new instance of Ws.
-
#test_(request_options: {}) ⇒ nil
Simple WebSocket test endpoint for connectivity testing.
Constructor Details
#initialize(client:) ⇒ Ws
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 Ws.
38 39 40 |
# File 'lib/believe/resources/client/ws.rb', line 38 def initialize(client:) @client = client end |
Instance Method Details
#test_(request_options: {}) ⇒ nil
Simple WebSocket test endpoint for connectivity testing.
Connect to test WebSocket functionality. The server will:
-
Send a welcome message on connection
-
Echo back any message you send
## Example
“‘javascript const ws = new WebSocket(“ws://localhost:8000/ws/test”); ws.onmessage = (event) => console.log(event.data); ws.send(“Hello!”); // Server responds with echo “`
31 32 33 |
# File 'lib/believe/resources/client/ws.rb', line 31 def test_(params = {}) @client.request(method: :get, path: "ws/test", model: NilClass, options: params[:request_options]) end |