Skip to content
This repository was archived by the owner on Dec 2, 2025. It is now read-only.

Commit 402258a

Browse files
authored
Merge pull request tillywork#267 from tillywork/fix-sockets
fix: sockets in production
2 parents 4bf0ca9 + bcd7e71 commit 402258a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

nginx/frontend.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ server {
1818
location /api {
1919
rewrite ^/api/(.*)$ /$1 break;
2020
proxy_pass http://localhost:3000;
21+
22+
proxy_http_version 1.1;
23+
proxy_set_header Upgrade $http_upgrade;
24+
proxy_set_header Connection "Upgrade";
25+
2126
proxy_set_header Host $host;
2227
proxy_set_header X-Real-IP $remote_addr;
2328
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

packages/frontend/src/composables/useSocket.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,21 @@ export function useSocket() {
1717
console.log(wsUrl);
1818
socket.value = io(wsUrl, {
1919
auth: { token: token.value },
20+
transports: ['polling', 'websocket'],
2021
});
2122

2223
socket.value.on('connect', () => {
2324
isConnected.value = true;
2425
});
2526

27+
socket.value.on('connect_error', (err) => {
28+
console.error('Connection error');
29+
console.error(err);
30+
});
31+
socket.value.on('connect_failed', (err) => {
32+
console.error('Connection failed');
33+
console.error(err);
34+
});
2635
socket.value.on('disconnect', () => {
2736
isConnected.value = false;
2837
});

0 commit comments

Comments
 (0)