File size: 2,618 Bytes
fbc078f
272dfc6
 
 
 
 
 
 
 
 
 
 
 
 
fbc078f
272dfc6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64e57ec
272dfc6
 
 
 
 
64e57ec
272dfc6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64e57ec
272dfc6
 
64e57ec
272dfc6
 
 
 
 
64e57ec
272dfc6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#  Complete Guide to Connect from Mobile Phone

## Step 1: Check Your Phone's Network

**On your phone:**
1. Open Settings → Wi-Fi
2. Look at which Wi-Fi network you're connected to
3. **Write down the Wi-Fi name (SSID)**

**On your PC:**
1. Open Settings → Network & Internet → Wi-Fi
2. Look at which Wi-Fi network you're connected to
3. **Make sure it's the EXACT SAME Wi-Fi as your phone**

 **IMPORTANT:** If they're on different Wi-Fi networks, connect your phone to the **same Wi-Fi** as your PC first!

---

## Step 2: Find Your PC's Wi-Fi IP

Run this in PowerShell:

```powershell
$wifiIP = (Get-NetIPConfiguration | Where-Object {$_.IPv4DefaultGateway -ne $null} | Select-Object -ExpandProperty IPv4Address).IPAddress
Write-Host "Your PC's Wi-Fi IP: $wifiIP"
```

Write down that IP. Example: `10.46.20.218`

---

## Step 3: Kill Old Server and Start Fresh

```powershell
cd C:\Users\dell\Downloads\message
taskkill /F /IM node.exe 2>$null
Start-Sleep -Seconds 2


$env:SSL_PFX_PATH = (Resolve-Path ".\certs\lan-localhost.pfx").Path
$env:SSL_PFX_PASSPHRASE = "123456"
$env:PORT = "3001"
$env:HOST = "0.0.0.0"


npm start
```

Wait for this message to appear:
```
✓ Real-time messaging
✓ Online users tracking
```

---

## Step 4: Connect from Phone

**On your phone browser:**
1. Open: `https://YOUR_WIFI_IP:3001`
   - Replace `YOUR_WIFI_IP` with the IP from Step 2
   - Example: `https://10.46.20.218:3001`

2. You'll see certificate warning:
   - Click "Advanced"
   - Click "Proceed to 10.46.20.218" (or whatever your IP is)

3. **You should now see the chat app!**

---

## If Still Not Working - Troubleshooting

### Check 1: Are you on the SAME Wi-Fi?
```powershell

ipconfig | findstr "Wi-Fi" -A 5


```

### Check 2: Is server actually listening?
```powershell
netstat -ano | findstr ":3001"

```

### Check 3: Firewall again (run as Admin)
```powershell
New-NetFirewallRule -DisplayName "Chat App HTTP" -Direction Inbound -LocalPort 3001 -Protocol TCP -Action Allow -Profile Any
```

### Check 4: Can you ping your PC from phone?
On phone, open a command app and try:
```
ping YOUR_PC_WIFI_IP
```
If you get "Timeout" or "Unreachable", the networks aren't connected.

---

## Nuclear Option - Try HTTP (Temporary Testing)

If HTTPS still fails, test with plain HTTP first:

```powershell
cd C:\Users\dell\Downloads\message
taskkill /F /IM node.exe 2>$null
$env:PORT = "3001"
npm start
```

Then on phone browser try: `http://10.46.20.218:3001` (no HTTPS)

If HTTP works but HTTPS doesn't, it's a certificate issue (easier to fix).
If even HTTP doesn't work, it's a network/firewall issue.