Preparing the backend server and simulation to talk with each other requires three steps:
- Host this backend server
- Connect this server with a database
- Connect the simulation with the server
- Clone this repository to a server (an EC2 instance using Ubuntu on AWS, for example)
- Install the required packages
In the directory with the server, run
npm install
- In this same directory, create a file called
.env
On a linux server through the terminal, as an example, you can run the command:
touch .env
- Add the database connection string to the
.env
file in the form ofMongoConnectionURI=<string>
, where<string>
is replaced with the connection string (see the database section).Example:
vim .env
Press
I
to insert textType
MongoConnectionURI=<insert connection string here>
Press
esc
Type
:wq
to save and close the file - Run the server
In the terminal, run
npm run go
- Create a database with MongoDB (you should have a connection string that contains a username and password for the database)
- Add this connection string to the server's
.env
fileExample:
vim .env
Press
I
to insert textType
MongoConnectionURI=<insert connection string here>
Press
esc
Type
:wq
to save and close the file
With the server running, you should have a URL that allows you to connect to the server.
- Open the Unity project in Unity
- In TelemetryManager.cs,
change the first line of the TelemetryManager class (currently line 39) to contain the backend server's URL
public static string url = "<insert server URL here>";
- Build the project to the headset