Update default port to 9090
This commit is contained in:
parent
e98dbaca8d
commit
7c4e81331b
@ -36,7 +36,7 @@ npm run dev:server
|
|||||||
Create a `.env` file in the root directory:
|
Create a `.env` file in the root directory:
|
||||||
|
|
||||||
```env
|
```env
|
||||||
PORT=8080
|
PORT=9090
|
||||||
JWT_SECRET_KEY=your-secret-key-here
|
JWT_SECRET_KEY=your-secret-key-here
|
||||||
DATABASE_PATH=./data/server.db
|
DATABASE_PATH=./data/server.db
|
||||||
RELAY_URLS=ws://localhost:8090,ws://relay2.example.com:8090
|
RELAY_URLS=ws://localhost:8090,ws://relay2.example.com:8090
|
||||||
@ -49,7 +49,7 @@ Connect to the WebSocket server and send messages in the same format as the brow
|
|||||||
|
|
||||||
### Example: Update Process
|
### Example: Update Process
|
||||||
```javascript
|
```javascript
|
||||||
const ws = new WebSocket('ws://localhost:8080');
|
const ws = new WebSocket('ws://localhost:9090');
|
||||||
|
|
||||||
ws.onopen = () => {
|
ws.onopen = () => {
|
||||||
ws.send(JSON.stringify({
|
ws.send(JSON.stringify({
|
||||||
@ -127,7 +127,7 @@ WORKDIR /app
|
|||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm ci --only=production
|
RUN npm ci --only=production
|
||||||
COPY server-dist ./server-dist
|
COPY server-dist ./server-dist
|
||||||
EXPOSE 8080
|
EXPOSE 9090
|
||||||
CMD ["node", "server-dist/server/server.js"]
|
CMD ["node", "server-dist/server/server.js"]
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ The server logs all operations with timestamps and client IDs:
|
|||||||
```
|
```
|
||||||
🚀 Initializing 4NK Protocol Server...
|
🚀 Initializing 4NK Protocol Server...
|
||||||
📡 Connecting to protocol relays...
|
📡 Connecting to protocol relays...
|
||||||
✅ Server running on port 8080
|
✅ Server running on port 9090
|
||||||
📋 Supported operations: UPDATE_PROCESS, NOTIFY_UPDATE, VALIDATE_STATE
|
📋 Supported operations: UPDATE_PROCESS, NOTIFY_UPDATE, VALIDATE_STATE
|
||||||
🔗 Client connected: client_1234567890_abc123 from 192.168.1.100
|
🔗 Client connected: client_1234567890_abc123 from 192.168.1.100
|
||||||
📨 Received message from client_1234567890_abc123: UPDATE_PROCESS
|
📨 Received message from client_1234567890_abc123: UPDATE_PROCESS
|
||||||
|
@ -4,7 +4,7 @@ import dotenv from 'dotenv';
|
|||||||
dotenv.config();
|
dotenv.config();
|
||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
port: parseInt(process.env.PORT || '8080'),
|
port: parseInt(process.env.PORT || '9090'),
|
||||||
apiKey: process.env.API_KEY || 'your-api-key-change-this',
|
apiKey: process.env.API_KEY || 'your-api-key-change-this',
|
||||||
databasePath: process.env.DATABASE_PATH || './data/server.db',
|
databasePath: process.env.DATABASE_PATH || './data/server.db',
|
||||||
relayUrls: process.env.RELAY_URLS?.split(',') || ['ws://localhost:8090'],
|
relayUrls: process.env.RELAY_URLS?.split(',') || ['ws://localhost:8090'],
|
||||||
|
@ -252,7 +252,7 @@ export class Server {
|
|||||||
private handlers!: SimpleProcessHandlers;
|
private handlers!: SimpleProcessHandlers;
|
||||||
private clients: Map<WebSocket, string> = new Map();
|
private clients: Map<WebSocket, string> = new Map();
|
||||||
|
|
||||||
constructor(port: number = 8080) {
|
constructor(port: number = 9090) {
|
||||||
this.wss = new WebSocket.Server({ port });
|
this.wss = new WebSocket.Server({ port });
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
@ -368,5 +368,5 @@ process.on('SIGTERM', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Start the server
|
// Start the server
|
||||||
const port = parseInt(process.env.PORT || '8080');
|
const port = parseInt(process.env.PORT || '9090');
|
||||||
const server = new Server(port);
|
const server = new Server(port);
|
@ -2,7 +2,7 @@ const WebSocket = require('ws');
|
|||||||
|
|
||||||
console.log('🔍 Testing WebSocket server connection...');
|
console.log('🔍 Testing WebSocket server connection...');
|
||||||
|
|
||||||
const ws = new WebSocket('ws://localhost:8080');
|
const ws = new WebSocket('ws://localhost:9090');
|
||||||
|
|
||||||
ws.on('open', function open() {
|
ws.on('open', function open() {
|
||||||
console.log('✅ Connected to server!');
|
console.log('✅ Connected to server!');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user