part 2 - communication
This commit is contained in:
@@ -32,10 +32,17 @@ func _closed(was_clean = false):
|
||||
print_debug("Closed. Clean break? ", was_clean)
|
||||
|
||||
func _connected(protocol = ""):
|
||||
print_debug("Connected with protocol ", protocol)
|
||||
print_debug("Connected with protocol: ", protocol)
|
||||
_client.get_peer(1).put_packet(JSON.print(
|
||||
{'type': 'test', 'message': "test packet from client"}).to_utf8())
|
||||
|
||||
func _on_data_received():
|
||||
pass
|
||||
var json = JSON.parse(_client.get_peer(1).get_packet().get_string_from_utf8())
|
||||
var packet = json.result
|
||||
if typeof(packet) != 18:
|
||||
push_error("%s is not a dictionary" % [packet])
|
||||
get_tree().quit()
|
||||
print_debug("Got data from server: ", packet)
|
||||
|
||||
func _process(_delta):
|
||||
_client.poll()
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ size_flags_vertical = 3
|
||||
margin_right = 236.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 0
|
||||
size_flags_vertical = 1
|
||||
text = "Chatbox"
|
||||
align = 1
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
[preset.0]
|
||||
|
||||
name="Linux/X11"
|
||||
platform="Linux/X11"
|
||||
runnable=true
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="../Exports/Chat Client.x86_64"
|
||||
script_export_mode=1
|
||||
script_encryption_key=""
|
||||
|
||||
[preset.0.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
binary_format/64_bits=true
|
||||
binary_format/embed_pck=false
|
||||
texture_format/bptc=false
|
||||
texture_format/s3tc=true
|
||||
texture_format/etc=false
|
||||
texture_format/etc2=false
|
||||
texture_format/no_bptc_fallbacks=true
|
||||
Reference in New Issue
Block a user