Thanks to @hungrymonkey I've come up with something like this:
# Server/client
func _ready(delta):
multiplayer.connect("network_peer_packet", self, "_on_packet_received")
multiplayer.send_bytes(PoolByteArray([0, 1, 2, 3]))
# Client/server
func _on_packet_received(id, packet):
print(packet)
I've also tried to send packets on an even lower level:
get_tree().network_peer.put_packet(packet)
In the network_peer_packet
callback when trying to receive packets on client I got errors like:
ERROR: _process_get_node: Condition ' !F ' is true. returned: __null
At: core/io/multiplayer_api.cpp:247
ERROR: _process_packet: Condition ' node == __null ' is true.
At: core/io/multiplayer_api.cpp:187
Which is most likely expected because I'm trying to mix different APIs or whatever... Anyway since there's send_bytes
introduced I don't think I need to go that low.