ACHCE Client uses Firebase Realtime Database to manage player connections and track active sessions. This guide walks you through setting up Firebase and integrating it with the application.
Your Firebase Realtime Database URL. Must end with a trailing slash.
2
Initialize Firebase Client
The client is initialized when the form loads:
Form1.cs:32-42
IFirebaseClient client;public void Form1_Load(object sender, EventArgs e){ try { // nuevo cliente en la base de datos client = new FireSharp.FirebaseClient(fcon); } catch { MessageBox.Show("there was problem in the internet."); } // ... rest of initialization}
The try-catch block handles connection errors gracefully by displaying a message if Firebase is unreachable.
When a player connects, their IP address is stored with a randomly generated name:
Form1.cs:58-69
private void PlayAcON(){ Player ply = new Player() { IP = IpPlayer, }; // informacion del cliente que se agrega a la base de datos var setter = client.Set("PlayerIpList/" + randomName, ply);}
Production Security RulesBefore deploying to production, configure proper Firebase security rules to restrict database access. Test mode rules allow anyone to read/write your database.