This is an Erlang based chat server.
Here are the instructions to run this application.
Erlang/OTP25 and rebar3 must be installed on your machine to build and run this application.
- erlcloud: used to connect to DynamoDB and interact with it, using methods to add, update or remove data from tables.
It is possible to log in to AWS using an IAM user to see the created EC2 instances, DynamoDB status and other thing created through CloudFormation templates. Here are the credentials for the AWS IAM user:
- Console link
- Username: coding_challenge
- User ID: 713881814113
- Open a terminal inside this project's base folder, then run the command:
$ rebar3 shell
- Open a terminal inside this project's base folder, then run the command:
$ rebar3 release
- Go inside the
_build/default/rel/coding_challenge/bin
folder - From a terminal, run the command:
$ coding_challenge foreground
- Go into the
apps/client
folder - From a terminal, run the command:
$ rebar3 shell
For quick testing, you can run one of these commands:
- Test clients
$ client_app:test_clients().
That will create 5 different clients and connect them to the server
- Test rooms
$ client_app:test_rooms().
This will connect some clients and create different rooms, testing various cases of error and success.
- Test private messages
$ client_app:test_private_messages().
This will connect some clients and send some private messages.
- Test private rooms
$ client_app:test_private_rooms().
This will create one private and one public room, testing various cases.
There are various other useful methods to test the single functions, like creating a room, joining a room, sending a message, etc. To use one of those methods, check the source code inside the client_app.erl file, from there you can see the exported methods you can use for testing purposes.