Project | Technologies | Overview | PokeTroca UseCase Views | Usage
PokeTroca is a distributed system of pokemon trade. This project gives to each registered user, ten random pokémons and you have to make the best team you can through good trades on the platform. With this project we could use three different communication between process for study reasons.
The methods are:
- Socket
- RMI
- Rest
Authors:
- Pedro Oliveira
- Samuel Costa Silva Nascimento
This project was made using the tecnologies below:
PokeTroca is composed by an architeture model on the physical layer as follows:
In other words, our system follows the client-server approach, where the client was made in Python using Kivy and Kivymd to create beauty and friendly views and the server using Python and SQLite as database.
The logical layer (code part) of the server follows the Clean Architeture model:
And about the client logical layer, it was made inspired on the traditional MVC architeture:
First of all, before make PokeTroca, we planned to use a simple route system created by us to simulate, even in Sockets or RMI methods, the request-response approch. In other words, we always send a route and params from client and we always expect this on the server side too and the reciprocal is true. Doing like this, we only had to be worry with the communication, the study object of this repository.
This project implements, as we said, different kinds of comunication. At a first time, we used Sockets that works sending bytes from each process. So we decided to use an external representation that is a known way of data in both client and server, the JSON representation, to avoid any possibility of wrong behaviour.
The second communication method was RMI (Remote Method Invocation) that instead of make a requisition and wait for some response, the client execute a pré defined remote call procedure shared between client and server through .proto archives. The gRPC (Google Remote Procedure Call) framework helps us use this archives and call the remote methods.
Finally, the most used communication method, Rest (Representational state transfer) is implemented here with an API using Flask. In the client side was used a python library to use the http methods and make requests to server.
PokeTroca platform wants to show you there are so many ways to plane an application and we have to consider the context and the goals it wants to reach. Make sure, before starts a new project, to keep in mind the plane phase have the same importance as the code phase to boost your success accuracy. For more details, you can acess the project doc in root path.
First you need to install Python3 to run the commands below, most times linux OS's already have this.
Make sure you're on the root path and follow the instructions below:
Go to backend root path:
cd backend
Install the server dependencies with:
make setup
Finally, choose the communication you want for the server and start running with the following:
make run-socket
make run-grpc
make run-rest
Go to socket client root path:
cd frontend-socket
Install dependencies with:
make setup
Then run using:
make run
Go to gRPC client root path:
cd frontend-grpc
Install dependencies with:
make setup
Then run using:
make run
Go to rest client root path:
cd frontend-rest
Install dependencies with:
make setup
Then run using:
make run
Clone this and use as example to study this mentioned communication methods.