Class: Believe::Resources::Client::Ws

Inherits:
Object
  • Object
show all
Defined in:
lib/believe/resources/client/ws.rb

Overview

WebSocket endpoints for real-time bidirectional communication - Live match simulation

Instance Method Summary collapse

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.

Parameters:



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:

  1. Send a welcome message on connection

  2. 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 “`

Parameters:

Returns:

  • (nil)

See Also:



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