Updated socket connection code to support docker.
This commit is contained in:
@@ -29,9 +29,9 @@ http {
|
|||||||
proxy_cache_bypass $http_upgrade;
|
proxy_cache_bypass $http_upgrade;
|
||||||
|
|
||||||
# CORS headers
|
# CORS headers
|
||||||
add_header 'Access-Control-Allow-Origin' '*'; # Allow all origins (can be restricted to a specific domain)
|
add_header 'Access-Control-Allow-Origin' '*';
|
||||||
add_header 'Access-Control-Allow-Methods' 'GET, POST'; # Allow GET and POST methods
|
add_header 'Access-Control-Allow-Methods' 'GET, POST';
|
||||||
add_header 'Access-Control-Allow-Headers' 'Content-Type, Accept'; # Standard headers for requests
|
add_header 'Access-Control-Allow-Headers' 'Content-Type, Accept';
|
||||||
}
|
}
|
||||||
|
|
||||||
# Error pages
|
# Error pages
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ const io = socketIo(server, {
|
|||||||
cors: {
|
cors: {
|
||||||
origin: "*",
|
origin: "*",
|
||||||
methods: ["GET", "POST"],
|
methods: ["GET", "POST"],
|
||||||
transports: ["polling", "websocket"],
|
allowedHeaders: ["Content-Type", "Accept"],
|
||||||
},
|
credentials: false
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
io.on("connection", (socket) => {
|
io.on("connection", (socket) => {
|
||||||
@@ -96,6 +97,6 @@ io.on("connection", (socket) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
server.listen(8081, () => {
|
server.listen(8081, '0.0.0.0', () => {
|
||||||
console.log("Server is running on port 8081");
|
console.log("Server is running on port 8081");
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user