-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprueba_websocket.gd
51 lines (35 loc) · 1.06 KB
/
prueba_websocket.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
extends Control
var server: WebServer
var client: WebClient
func _ready() -> void:
pass
func _on_server_2_pressed() -> void:
if client or server:
return
server = WebServer.new("*", 8080)
add_child(server)
#server.send.rpc("hola a todos") # get_tree().root.
pass # Replace with function body.
func _on_cliente_pressed() -> void:
#if server : ////para crear instanccias de esto
#return
client = WebClient.new()
add_child(client)
await get_tree().create_timer(2).timeout
client.command("hola del cliente") # use rcp no funciones de clase
pass # Replace with function body. get_tree().root.
func _on_button_pressed() -> void:
if server != null:
pass
server.send_sms.rpc("hola a todos desde el server")
if client != null:
client.send_sms.rpc("hola a todos desde el cliente ")
func _on_peers_pressed() -> void:
if server == null:
prints(client.multiplayer.get_peers())
return
prints(server.multiplayer.get_peers())
pass # Replace with function body.
func _on_quit_pressed() -> void:
queue_free()
pass # Replace with function body.