Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local Server

This project provides a lightweight local launcher and API server for a VR training/game setup. It runs as an Electron desktop application, exposes a REST API and WebSocket relay, and helps coordinate communication between a local game client, browser-based viewers, and profile picture uploads.

Overview

The application is designed to:

  • start and stop an internal Express server
  • expose the machine's local network IP so clients can connect
  • serve uploaded profile pictures
  • relay live game/session data over WebSockets
  • start or stop an external Unity game executable
  • provide a status endpoint for health checks

It is intended for local or LAN-based deployments where a desktop launcher must coordinate with a VR game and a web dashboard.

Tech Stack

  • Electron
  • Express.js
  • WebSockets via ws
  • Multer for file uploads
  • CORS support

Project Structure

local_server/
├── main.js                 # Electron app entry point
├── preload.js              # Electron preload bridge
├── package.json            # Node dependencies and scripts
├── renderer/
│   ├── index.html
│   ├── renderer.js
│   └── style.css
├── server/
│   └── server.js           # Express server + WebSocket relay
├── ProfilePictures/        # Uploaded profile image storage
├── local_server/           # Additional local runtime artifacts if present
└── README.md

Features

Server management

The Electron app exposes buttons to start and stop the local server. Once the server is running, the app shows the local machine IP to help connect other devices on the same network.

Profile picture upload

The server supports uploading and deleting profile images:

  • POST /upload-profile-picture
  • DELETE /profile-pictures/:filename

Files are stored in the ProfilePictures directory and served through the /profile-pictures route.

Game control

The application can launch and stop an external game executable by calling:

  • POST /start-game
  • POST /stop-game

The default executable path is configured as:

C:\MyGame\Build\MyVRGame.exe

If the game binary is not available at that location, the API returns an error.

Status and realtime data

The server provides:

  • GET /status

This returns whether the server is active, whether a game is running, and whether the Unity client is connected.

The WebSocket relay allows:

  • Unity clients to send live stats and session events
  • browser clients to receive updates in real time
  • commands to be forwarded from viewer clients to the game client

Installation

  1. Open a terminal in the project folder.
  2. Install dependencies:
npm install

Running the app

Start the Electron launcher:

npm start

This opens the desktop UI and allows you to start the server from the interface.

Production Build

To build an application package:

npm run dist

Notes

  • The application listens on port 3000.
  • The server binds to 0.0.0.0, allowing access from devices on the same local network.
  • Uploaded images are restricted to common image formats: JPEG, PNG, GIF, and WebP.
  • The maximum upload size is set to 5 MB per file.

Security / usage notes

This project is intended for local laboratory or internal deployment use. The server does not implement advanced authentication, authorization, or production hardening features, so it should not be exposed to untrusted networks without additional safeguards.

License

This project is licensed under the ISC license.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages