Class: VRTQL::Connection

Inherits:
Object
  • Object
show all
Defined in:
doc/vrtql.rb

Overview

This class manages a WebSocket connection to a VRTQL server. It provides methods for sending and receiving VRTQL messages.

Instance Method Summary collapse

Constructor Details

#initializeConnection

Initializes a new Connection object.



9
10
11
# File 'doc/vrtql.rb', line 9

def initialize
  # Implementation is in the C-extension
end

Instance Method Details

#format=(value) ⇒ Integer

Sets default serialize format. Every message will be sent in this format unless specifically overridden using the ‘format` argument of the the Connection#send() method.

Parameters:

  • format (:Symbol)

    (optional) Specify the serialization format. This can be either :json or :mpack. The default is :mpack.

Returns:

  • (Integer)

    The number of bytes sent.



20
21
22
# File 'doc/vrtql.rb', line 20

def format=(value)
  # Implementation is in the C-extension
end

#receiveVRTQL::Message?

Receives a VRTQL message from the WebSocket connection.

received.

Returns:

  • (VRTQL::Message, nil)

    The received message, or nil if no message was



39
40
41
# File 'doc/vrtql.rb', line 39

def receive
  # Implementation is in the C-extension
end

#send(value, format = :mpack) ⇒ Integer

Sends a VRTQL message via the WebSocket connection.

Parameters:

  • value (VRTQL::Message)

    The message to send.

  • format (:Symbol) (defaults to: :mpack)

    (optional) The serialization format. This can be either :json or :mpack. The default is to use whatever format is specified by the Connect#format= method. The default is :mpack.

Returns:

  • (Integer)

    The number of bytes sent.



31
32
33
# File 'doc/vrtql.rb', line 31

def send(value, format=:mpack)
  # Implementation is in the C-extension
end