Fix WebSocket connection - use main API domain instead of ws subdomain
All checks were successful
Build Frontend / Build Frontend (push) Successful in 9s
All checks were successful
Build Frontend / Build Frontend (push) Successful in 9s
- Updated WebSocket URL to use api.turbotrades.dev instead of ws.turbotrades.dev - Added frontend .env.production with correct VITE_WS_URL - Added frontend .env.development for local development - WebSocket now connects to wss://api.turbotrades.dev/ws
This commit is contained in:
@@ -31,14 +31,17 @@ export const useWebSocketStore = defineStore("websocket", () => {
|
||||
|
||||
// Helper functions
|
||||
const getWebSocketUrl = () => {
|
||||
// Use environment variable or fallback to ws subdomain
|
||||
// Use environment variable or fallback
|
||||
if (import.meta.env.VITE_WS_URL) {
|
||||
return import.meta.env.VITE_WS_URL;
|
||||
}
|
||||
|
||||
// In production, use dedicated WebSocket domain
|
||||
// In production, use main API domain with /ws path
|
||||
if (import.meta.env.PROD) {
|
||||
return "wss://ws.turbotrades.dev";
|
||||
const apiUrl =
|
||||
import.meta.env.VITE_API_URL || "https://api.turbotrades.dev";
|
||||
// Convert http(s):// to ws(s)://
|
||||
return apiUrl.replace(/^http/, "ws") + "/ws";
|
||||
}
|
||||
|
||||
// In development, use current host with ws path (for proxy)
|
||||
|
||||
Reference in New Issue
Block a user