Skip to content

Commit 73f7db2

Browse files
committed
chore: implementation.
1 parent 8f2862b commit 73f7db2

File tree

4 files changed

+529
-71
lines changed

4 files changed

+529
-71
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
extends Node
2+
3+
4+
# Called when the node enters the scene tree for the first time.
5+
func _ready() -> void:
6+
pass # Replace with function body.
7+
8+
func init_network(host: String) -> MultiplayerPeer:
9+
var socket: MultiplayerPeer;
10+
#if OS.has_feature("dedicated_server"):
11+
print("Connecting to Kafka Broker: ", host)
12+
var kafka: KafkaMultiplayerPeer = KafkaMultiplayerPeer.new();
13+
kafka.register_publisher("server-to-client", host, 1);
14+
kafka.register_subscriber(["client-to-server"], host, "group-name", 1);
15+
socket = kafka;
16+
#else:
17+
#print("Connecting to a Websocket URL: ", host)
18+
#var websocket: WebSocketMultiplayerPeer = WebSocketMultiplayerPeer.new();
19+
#websocket.create_client(host)
20+
#socket = websocket;
21+
#
22+
# Set the Multiplayer API to be pointed on the peer above.
23+
# At this point, the peer should be polling data.
24+
multiplayer.multiplayer_peer = socket;
25+
return socket;

0 commit comments

Comments
 (0)