Check the server.js and the client.js I will upload above.( The client.js may be used from more than 1 devices, but the server.js no)
Just follow my instructions:
1)Download client1 & client2 in different devices.
2)Create a firebase account.
3)Create a database. (NOT FILE CLOUDSTORE)
4)Copy your firebase config and paste it in each client.
5)Run the two clients.
If everything goes good, you should see the text you type from the device that uses client 2 to the other of the client 1.
I hope that helped you get a small idea of the firebase performance.
Test it and if you have any questions, an me.
But, because firebase is a websocket from a remote server in google, you must try a trick I also did to create a "server".
If you want to make something more commercial, you will definitely need to use the firebase database security rules.
If you want to make something for fun, I suggest you use the test mode.
If you want try the following unfinished game I am making:
*Use 2 phone devices and one computer.
*Open the game from the 2 devices.
*Open the server.html from any browser in your computer.
I will upload the Game.js and server.html latter that day, because I do not have my computer with that file here.
Server.html includes:
*Matchmaking for players.
*Battle servering.
The only thing is that, I have made it to handle only one game per time, because I wanted the highest performance.
Regards
I am still working the server and client.
In that case I cannot give you the client and server files.
I can just advice you what to do.
*Download and install nodejs in your computer.
*Go at the console of your firebase prpject.
*Click functions.
*Follow the instructions there.
*Then you can easily say in your index.js file (you will understand want I mean if you do the above) and write the code auth.listUsers(max).then(OnListResult);
And you can have access to all database because you are connected as admin.
Or you can also use the functions by uploading this file using firebase deploy command in nodejs.
I think you will find it difficult but you will make it.
I learned all this in some hours, so try it too.
(If you see in nodejs a logging error about the credential, you will need to go to firebase/your project/setting/General/Service accounts and create a new secret key. Follow the instructions there too and put the in your config Jason.)
I hope that helped!
Regards
If it is the phone just include the Firebase folder in your project.
Just like I did in the spks above.
Try to unchecked the 'Obfuscate Code' option and build the Apk using debug.
Try it and tell me.
Check also the Apk of these two spks I had posted.
Try to build the app your self to have access to this app from the firebase console.
The firebase config can be found in the console.firebase.google.com
Open your project, go to settings,
Click add an other app, choose the WebApp option (DroidScript is like a WebView, that's why)
and coppy the code it will show you.
It is not needed to complete the 'Add Web App' operation. Just make this process to get your firebase config (not the SDK).
I would advice you not to use the firebase functions yet, because you are not ready. Forget the NodeJS for some time and try to understand how the firebase works.
Client-> makes a request.
Server-> answers this request.
Client-> receives the answer.
Eg.
Client-> Matchmake me.
Server-> {battleId}
Client-> Cancel my Matchmake.
Server-> //Ignore's it,battle has started.
Client->//Gets in the battle screen
When the server.js starts, mind that you must always reset the game states.
As I did the very beginning, you can
store the users data on a path named '/users' and a user would seem like '/users/{uid}'
To receive battle requests, create a folder '/battleReq'
and listen to it from the server.js
//db.ref('battleReq').on("value",BattleRequest);
As I said above, always reset all the states, by setting all user states to 'home' screen.
Eg.
/users/{uid}/state = "battle" -> /users/{uid}/state = "home";
I think you got a little piece of the server-client logic. Try to make a server and a client and tell me.
Do the apks that I have shared work to you?
Try the following spks and tell me.
Try the v1 and if it doesn't work try the v2 and tell me. I have used me own firebaseConfig to make sure this will not a problem.
1)Make sure you have created a realtime database. If not make it!
(Important: RealTime Database, not File Cloudstore)
2)Go to the Authentication option and go to sign in methods. Enable only the Email one. (No gmail or anything else).
Try and tell me!
Regards