8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/javonet-ruby-sdk/core/interpreter/interpreter.rb', line 8
def execute(command, connection_type, connection_data)
message_byte_array = CommandSerializer.new.serialize(command, connection_data)
if command.runtime_name == RuntimeNameJavonet::RUBY && connection_type == ConnectionType::IN_MEMORY
require_relative '../receiver/receiver_new'
response_byte_array = Receiver.new.send_command(message_byte_array)[1]
elsif connection_type == ConnectionType::WEB_SOCKET
require_relative '../web_socket_client/web_socket_client'
response_byte_array = WebSocketClient.send_message(connection_data.hostname, message_byte_array)
else
require_relative '../transmitter/transmitter'
response_byte_array = Transmitter.send_command(message_byte_array, message_byte_array.length)
end
CommandDeserializer.new(response_byte_array).deserialize
end
|