GodotPythonJSONRPC/Control.gd
2024-07-14 18:40:49 -07:00

52 lines
1.4 KiB
GDScript

extends Control
#var packet_socket_server : KiriPacketSocket
var wrapper_instance : KiriPythonWrapperInstance
#var active_connections = []
func _ready():
var jrpc : KiriJSONRPC = KiriJSONRPC.new()
var x = jrpc.make_request("make_request", [ "bar", "wharrgarbl", 123 ], 1)
#var x = jrpc.make_request("can_translate_message", [], 1)
print(x)
var c = jrpc.process_action_safer(x)
print("process action: ", c)
#packet_socket_server = KiriPacketSocket.new()
##packet_socket_server.start_server(["127.0.0.1", 9506])
#packet_socket_server.start_client(["127.0.0.1", 9506])
#active_connections.append(packet_socket_server)
wrapper_instance = KiriPythonWrapperInstance.new(
"/storage/git2/GodotJSONRPCTest/addons/kiripythonrpcwrapper/KiriPythonRPCWrapper/test_module/__init__.py")
wrapper_instance.start_process()
func _process(_delta):
pass
#var next_connection = packet_socket_server.get_next_server_connection()
#if next_connection:
#active_connections.append(next_connection)
#print("GOT A NEW CONNECTION!")
#for conn in active_connections:
#var p = conn.get_next_packet()
#while p:
#print("PACKET: ", p)
#conn.send_packet(p)
#p = conn.get_next_packet()
wrapper_instance.poll()
#print(wrapper_instance.get_status())
wrapper_instance.call_rpc_callback("func_to_call", [12345], func(stuff):
print(stuff.response)
)
#wrapper_instance.call_rpc_sync("func_to_call", [12345])