'use proxy pass xampp for socket.io node js server
I been trying to open the website from my mobile. I made two servers. One using xampp and php to run the website and get data from database. The second server is for running web socket. Real time chat and drawing. So server1 is in port 3000 and server2 is in 8000. how can I open both server in my mobile?
I tried
I put this in httpd.conf:
ProxyPass /node http://localhost:8000
and then in the client side, I put:
var socket = io('http://localhost/node', { transports : ['websocket']});
I am getting error:
WebSocket connection to 'ws://localhost/socket.io/?EIO=4&transport=websocket' failed:
node js setup:
const http = require('http');
const socket = require('socket.io');
const port = process.env.PORT || "8000";
const server = http.createServer((req,res)=>{
res.end('I am connected!');
});
const io = socket(server);
io.on('connection',(socket,req)=>{
socket.emit('Welcome','Welcome to the websocket server!!');
});
server.listen(port);
xampp setup:
$login = new Login();
$user_data = $login->check_login($_SESSION['Trial_User_Id']);
[xampp window][1]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
