Professional Node.js WebSocket backend for multiplayer session handling in Godot projects. Designed for fast local testing, mobile-first workflows, and public distribution alongside a Godot multiplayer plugin.
- WebSocket real-time communication
- Mobile-first support
- Termux compatibility
- Desktop compatibility
- Session handling
- Room system
- UUID client identification
- Fast setup
- Lightweight architecture
- Production deploy ready
- Node.js minimum version: 18.x recommended
- npm
- Android with Termux (optional)
- PC support on Windows, Linux, and macOS
Install Termux from Google Play Store:
Or use the official release channel:
GitHub release is recommended for the latest updates and package availability.
Update the package list first:
pkg update && pkg upgradeInstall Node.js:
pkg install nodejsVerify the installation:
node -v
npm -vBefore installing dependencies, clone the project repository.
If Git is not installed yet:
pkg install gitClone the repository:
git clone [REPOSITORY_URL]
cd [PROJECT_FOLDER]Clone the repository:
git clone [REPOSITORY_URL]
cd [PROJECT_FOLDER]- Download ZIP from GitHub
- Extract the files
- Open the project folder
After cloning or extracting, continue with dependency installation.
Install the backend dependencies:
npm install express ws uuidDependency overview:
- express → HTTP support
- ws → WebSocket server
- uuid → unique session/client IDs
Important note:
- The current server runtime path is WebSocket-first and depends on
ws. expressanduuidare included because they are common backend companions for public multiplayer stacks and future HTTP or identifier extensions.- If your cloned project already contains a
package.json, keep using the repository-defined dependency set.
Create a working folder if you are starting from scratch:
mkdir multiplayer-server
cd multiplayer-serverInitialize the Node.js project if needed:
npm init -yExpected project structure:
server/
├── server.js
├── package.json
├── node_modules/
If you cloned the repository, place the source files inside the project folder and keep the structure aligned with the server entry file.
Start the backend:
node server.jsExpected startup output:
Servidor WebSocket rodando na porta 9090. Aguardando jogadores...
In this repository, the default port is 9090 unless you change it in server.js.
Find your device IP address on Wi-Fi:
ifconfigLook for the inet xxx.xxx.xxx.xxx line.
Example:
192.168.0.105
The Godot client connects using:
ws://192.168.0.105:PORT
Important:
- The client device must be on the same network.
localhostonly works on the same device running the server.
Windows, Linux, and macOS are supported.
Install Node.js from the official website:
Then install the dependencies and run the server:
npm install
node server.jsThis server can be deployed online on:
- Render
- Railway
- VPS
- Docker
- Any host that supports Node.js
When deployed behind TLS, the client should connect using:
wss://your-server-url
For production, prefer a reverse proxy with HTTPS/TLS enabled.
- Client connects
- UUID assigned
- Session created
- Room join
- State sync
- Broadcast updates
- Disconnect cleanup
Install dependencies:
npm installRun the server:
node server.jsHot reload option:
npm install -g nodemon
nodemon server.jsInstall Node.js again and verify that node and npm are available in the terminal.
Install dependencies again:
npm installChange the server port in server.js and restart the process.
Check the following:
- Both devices are on the same Wi-Fi network
- The local IP is correct
- Firewall rules are not blocking the port
- The Godot plugin has internet permission enabled
The server may be offline, unreachable, or the port may be blocked by the network or device firewall.
- Keep packet sizes small
- Avoid excessive broadcasts
- Limit tick rate
- Use interpolation client-side
- Reduce JSON overhead when possible
- Validate messages
- Sanitize inputs
- Never trust client authority blindly
- Use rate limiting in production
Termux is ideal for quick mobile testing on Android.
Recommended workflow:
- Edit in Godot
- Run the backend in Termux
- Test the local APK
- Deploy after validation
This is the recommended mobile-first workflow for fast iteration before moving to a public host.
Placeholder
Placeholder
Placeholder
Backend profissional em Node.js com WebSocket para gerenciamento de sessões multiplayer em projetos Godot. Projetado para testes locais rápidos, fluxo mobile-first e distribuição pública junto de um plugin multiplayer para Godot.
- Comunicação em tempo real via WebSocket
- Suporte mobile-first
- Compatibilidade com Termux
- Compatibilidade com desktop
- Gerenciamento de sessões
- Sistema de salas
- Identificação de clientes por UUID
- Configuração rápida
- Arquitetura leve
- Pronto para deploy em produção
- Versão mínima recomendada do Node.js: 18.x
- npm
- Android com Termux (opcional)
- Suporte para PC em Windows, Linux e macOS
Instale o Termux pela Google Play Store:
Ou use o canal oficial de releases:
Recomendação: o GitHub release é preferível para receber atualizações mais recentes e melhor disponibilidade de pacotes.
Atualize a lista de pacotes primeiro:
pkg update && pkg upgradeInstale o Node.js:
pkg install nodejsVerifique a instalação:
node -v
npm -vAntes de instalar dependências, clone o repositório do projeto.
Se o Git ainda não estiver instalado:
pkg install gitClone o repositório:
git clone [REPOSITORY_URL]
cd [PROJECT_FOLDER]Clone o repositório:
git clone [REPOSITORY_URL]
cd [PROJECT_FOLDER]- Baixe o ZIP do GitHub
- Extraia os arquivos
- Abra a pasta do projeto
Depois de clonar ou extrair, continue com a instalação das dependências.
Instale as dependências do backend:
npm install express ws uuidVisão geral das dependências:
- express → suporte HTTP
- ws → servidor WebSocket
- uuid → IDs únicos de sessão / cliente
Observação importante:
- O fluxo atual do servidor é centrado em WebSocket e depende de
ws. expresseuuidforam incluídos porque são companheiros comuns em stacks públicas de multiplayer e extensões futuras de HTTP ou identificação.- Se o repositório clonado já incluir
package.json, mantenha o conjunto de dependências definido pelo projeto.
Crie uma pasta de trabalho se você estiver começando do zero:
mkdir multiplayer-server
cd multiplayer-serverInicialize o projeto Node.js se necessário:
npm init -yEstrutura esperada do projeto:
server/
├── server.js
├── package.json
├── node_modules/
Se você clonou o repositório, coloque os arquivos-fonte dentro da pasta do projeto e mantenha a estrutura alinhada com o arquivo de entrada do servidor.
Inicie o backend:
node server.jsSaída esperada na inicialização:
Servidor WebSocket rodando na porta 9090. Aguardando jogadores...
Neste repositório, a porta padrão é 9090, a menos que você a altere em server.js.
Encontre o endereço IP do dispositivo na rede Wi-Fi:
ip addr show wlan0Procure pela linha inet xxx.xxx.xxx.xxx.
Exemplo:
192.168.0.105
O cliente Godot conecta usando:
ws://192.168.0.105:PORT
Importante:
- O dispositivo cliente precisa estar na mesma rede.
localhostsó funciona no mesmo dispositivo que está rodando o servidor.
Windows, Linux e macOS são suportados.
Instale o Node.js no site oficial:
Depois instale as dependências e execute o servidor:
npm install
node server.jsEste servidor pode ser hospedado online em:
- Render
- Railway
- VPS
- Docker
- Qualquer host com suporte a Node.js
Quando estiver atrás de TLS, o cliente deve conectar usando:
wss://your-server-url
Em produção, prefira um reverse proxy com HTTPS/TLS habilitado.
- O cliente conecta
- O UUID é atribuído
- A sessão é criada
- O cliente entra em uma sala
- O estado é sincronizado
- As atualizações são transmitidas por broadcast
- A limpeza ocorre na desconexão
Instalar dependências:
npm installExecutar o servidor:
node server.jsHot reload opcional:
npm install -g nodemon
nodemon server.jsInstale o Node.js novamente e verifique se node e npm estão disponíveis no terminal.
Instale as dependências novamente:
npm installAltere a porta do servidor em server.js e reinicie o processo.
Verifique os seguintes pontos:
- Ambos os dispositivos estão na mesma rede Wi-Fi
- O IP local está correto
- As regras de firewall não estão bloqueando a porta
- O plugin Godot está com permissão de internet habilitada
O servidor pode estar offline, inacessível ou a porta pode estar bloqueada pela rede ou pelo firewall do dispositivo.
- Mantenha os pacotes pequenos
- Evite broadcasts excessivos
- Limite a taxa de atualização
- Use interpolação no cliente
- Reduza o overhead de JSON quando possível
- Valide mensagens
- Sanitize inputs
- Nunca confie cegamente na autoridade do cliente
- Use rate limiting em produção
O Termux é ideal para testes rápidos no Android.
Fluxo recomendado:
- Edite no Godot
- Rode o backend no Termux
- Teste o APK localmente
- Faça deploy após validação
Este é o fluxo mobile-first recomendado para iterar rapidamente antes de publicar em um host online.
Placeholder
Placeholder
Placeholder