deployment-talks/chat-app/frontend/websocket.js

12 lines
243 B
JavaScript
Raw Normal View History

export function createWebSocket() {
let appUrl = process.env.APP_URL;
if (appUrl.includes('localhost')) {
appUrl = `//${appUrl}/chat-service`;
} else {
appUrl = `//${appUrl}/chat-service`;
}
return new WebSocket(appUrl);
}