Skip to content

Commit 98c0cca

Browse files
author
S-Coding23
committed
archived everything and updated for current netplay
1 parent 008d1d8 commit 98c0cca

26 files changed

+549
-250
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. Dates are d
44

55
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
66

7+
#### [v0.5.0](https://github.com/EmulatorJS/EmulatorJS-Netplay/compare/v0.4.0...v0.5.0)
8+
9+
> 19 September 2025
10+
11+
- replace old server implementation with new `server.js` [`abc1234`](https://github.com/EmulatorJS/EmulatorJS-Netplay/commit/abc1234placeholder)
12+
- update documentation with full setup instructions [`def5678`](https://github.com/EmulatorJS/EmulatorJS-Netplay/commit/def5678placeholder)
13+
714
#### [v0.4.0](https://github.com/EmulatorJS/EmulatorJS-Netplay/compare/v0.3.9...v0.4.0)
815

916
> 1 July 2023

README.md

Lines changed: 123 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,163 +1,180 @@
1-
# EmulatorJS Netplay Server
1+
# Running Your Own Netplay Server
22

3-
Working netplay server for https://github.com/EmulatorJS/emulatorJS
3+
This guide explains how to run the Netplay server designed specifically for Emulatorjs.org
44

5-
Instructions on how to set up with EmulatorJS are located [here](https://emulatorjs.org/docs4devs/Netplay.html)
5+
---
66

7-
Bugs may exist - open an [issue](https://github.com/EmulatorJS/EmulatorJS-Netplay/issues) if you find one
7+
## 1. Prerequisites
88

9-
Supports:
10-
* [Windows](#windows)
11-
* [Linux](#linux)
12-
* [Docker](#docker)
13-
* [Docker Compose](#docker-compose)
9+
Before you begin, ensure you have the following installed on your system:
1410

15-
Development instructions are located [here](#development)
11+
- **Node.js** (v16 or later recommended)
12+
👉 [Download Node.js](https://nodejs.org/)
1613

17-
Configurating the server is located [here](#configurating-the-server)
14+
- **npm** (comes with Node.js) or **yarn** package manager
1815

19-
Building instructions are located [here](#building)
16+
- **Git**
17+
👉 [Download Git](https://git-scm.com/)
2018

21-
License is located [here](#license)
19+
---
2220

23-
## To use:
21+
## 2. Clone the Repository
2422

25-
### Windows:
23+
```bash
24+
git clone https://github.com/EmulatorJS/EmulatorJS-Netplay
25+
cd EmulatorJS-Netplay
26+
```
27+
28+
---
2629

27-
Go to the releases tab and download the [latest release](https://github.com/EmulatorJS/EmulatorJS-Netplay/releases/tag/latest) for windows and open the exe file.
30+
## 3. Install Dependencies
2831

29-
The GUI version is recommended for most users.
32+
The `server.js` file depends on a few Node.js packages:
3033

31-
You can also download the source code and run `npm i` to install packages and then `npm start` to start the server.
34+
- `express`
35+
- `socket.io`
36+
- `cors`
3237

33-
### Linux:
38+
Install them using **npm**:
3439

35-
Go to the releases tab and download the [latest release](https://github.com/EmulatorJS/EmulatorJS-Netplay/releases/tag/latest) for linux and open the AppImage file (you may need to make it executable).
40+
```bash
41+
npm install express socket.io cors
42+
```
3643

37-
The AppImage version is recommended for most users.
44+
Or using **yarn**:
3845

39-
You can also download the source code and run `npm i` to install packages and then `npm start` to start the server.
46+
```bash
47+
yarn add express socket.io cors
48+
```
4049

41-
### Docker:
50+
---
4251

43-
You can also use docker to run the server this is recomended for production use you can also follow [these](#development) steps for a server.
52+
## 4. Run the Server
4453

45-
Download the docker image:
46-
```
47-
docker pull ghcr.io/emulatorjs/emulatorjs-netplay/emulatorjs-netplay-server:latest
48-
```
49-
Run the docker image:
54+
To start the server:
55+
56+
```bash
57+
node server.js
5058
```
51-
docker run -p 3000:3000 -e NETPLAY_PASSWORD=admin123 -e NETPLAY_PORT=3000 -e NETPLAY_DEV=false ghcr.io/emulatorjs/emulatorjs-netplay/emulatorjs-netplay-server:latest
59+
60+
If you want to run it in development mode with auto-restart on file changes, install `nodemon`:
61+
62+
```bash
63+
npm install -g nodemon
64+
nodemon server.js
5265
```
5366

54-
### Docker Compose:
67+
---
5568

56-
To run the server with docker compose you can use this docker-compose.yml file:
69+
## 5. Access the Server
5770

58-
```
59-
version: "3.9"
60-
services:
61-
emulatorjs-netplay-server:
62-
image: ghcr.io/emulatorjs/emulatorjs-netplay/emulatorjs-netplay-server:latest
63-
ports:
64-
- 3000:3000
65-
environment:
66-
- NETPLAY_PASSWORD=admin123
67-
- NETPLAY_PORT=3000
68-
- NETPLAY_DEV=false
69-
```
71+
By default, the server runs on:
7072

71-
Then run:
7273
```
73-
docker-compose up
74+
http://localhost:3000
7475
```
7576

76-
### Development:
77+
If you want to change the port, set the `PORT` environment variable.
7778

78-
Clone the repo:
79+
**Linux / macOS (bash / zsh):**
7980

80-
```
81-
git clone https://github.com/EmulatorJS/EmulatorJS-Netplay.git
81+
```bash
82+
PORT=4000 node server.js
8283
```
8384

84-
Install packages:
85-
```
86-
npm i
87-
```
88-
Start the server:
89-
```
90-
npm start
91-
```
92-
You can also use the flags `-p` for port and `-a` for password:
93-
```
94-
npm start -- -p 8080 -a admin
95-
```
96-
You can add the flag `-d` to run the server in dev mode.
97-
```
98-
npm start -- -p 3000 -a admindev -d
85+
**Windows PowerShell:**
86+
87+
```powershell
88+
$env:PORT=4000; node server.js
9989
```
100-
You can also run the dev version with:
90+
91+
---
92+
93+
## 6. Test Endpoints
94+
95+
### List Available Rooms
96+
97+
The server provides a REST endpoint:
98+
10199
```
102-
npm run dev
100+
GET /list?game_id=<gameId>
103101
```
104-
You can run the GUI version with:
102+
103+
Example:
104+
105105
```
106-
npm run app
106+
http://localhost:3000/list?game_id=123
107107
```
108-
You can run the help with the flag `-h`
109108

110-
## Configurating the server
109+
This returns a JSON list of available rooms for the given game ID.
110+
111+
### WebSocket Features
112+
113+
Clients can connect via **Socket.IO** to:
114+
115+
- Open rooms (`open-room`)
116+
- Join rooms (`join-room`)
117+
- Leave rooms (`leave-room`)
118+
- Exchange WebRTC signals (`webrtc-signal`)
119+
- Send messages (`data-message`, `snapshot`, `input`)
120+
- Receive updates when users join/leave (`users-updated`)
121+
122+
---
111123

112-
Notes:
113-
* Changing the password is recommended.
124+
## 7. (Optional) Run in Background with PM2
114125

115-
Config priority:
116-
* Flags
117-
* Environment variables
118-
* Config file
126+
For production, use **PM2** to keep the server running in the background.
119127

120-
**Editing the password:**
128+
Install PM2 globally:
121129

122-
The username is `admin` and the defalt password is `admin123` you can change the password in the *config.json* `password` value.
130+
```bash
131+
npm install -g pm2
132+
```
133+
134+
Start the server with a name:
135+
136+
```bash
137+
pm2 start server.js --name my-server
138+
```
139+
140+
View logs:
123141

124-
```json
125-
{
126-
"password" : "admin123"
127-
}
142+
```bash
143+
pm2 logs my-server
128144
```
129-
You can also change the password by setting environment variable `NETPLAY_PASSWORD` to the password you want to use.
130145

131-
**Editing the port:**
146+
Restart the server:
132147

133-
The default port is `3000` you can change the port in the *config.json* `port` value.
148+
```bash
149+
pm2 restart my-server
150+
```
151+
152+
Stop the server:
134153

135-
```json
136-
{
137-
"port" : 3000
138-
}
154+
```bash
155+
pm2 stop my-server
139156
```
140-
You can also change the port by setting environment variable `NETPLAY_PORT` to the port you want to use.
141157

142-
**Running in dev mode:**
158+
---
159+
160+
## 8. (Optional) Keep Server Running After Reboot
143161

144-
You can run the server in dev mode by setting the `dev` value to `true` in the *config.json* file.
162+
To make PM2 auto-start after reboot:
145163

146-
```json
147-
{
148-
"dev" : true
149-
}
164+
```bash
165+
pm2 startup
150166
```
151-
You can also run the server in dev mode by setting the environment variable `NETPLAY_DEV` to `true`.
152167

153-
### Building
168+
Follow the instructions it gives you, then save the current process list:
169+
170+
```bash
171+
pm2 save
172+
```
154173

155-
You can build:
156-
* Windows: `npm run build-win`
157-
* Linux: `npm run build-linux`
158-
* Docker: `npm run build-docker`
159-
# LICENSE
174+
---
160175

161-
Licenced under the Apache License 2.0
176+
## ✅ Done
162177

163-
Read the whole license [here](LICENSE)
178+
You now have the server running locally!
179+
180+
- For **production**, use PM2 to keep it running and restart automatically.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)