Skip to content

Commit 859ca75

Browse files
committed
feat: enable socket scaling
1 parent 1fa6ba9 commit 859ca75

File tree

6 files changed

+21
-5
lines changed

6 files changed

+21
-5
lines changed

nginx/default.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ server {
1919

2020

2121
root /usr/share/nginx/html;
22+
proxy_http_version 1.1;
23+
proxy_set_header Upgrade $http_upgrade;
24+
proxy_set_header Connection "upgrade";
2225

2326

2427
location / {

src/app/core/services/contacts-socket.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export class ContactsSocketService extends Socket {
77

88
constructor() {
99
super({
10-
url: `${environment.socketConfig.url}/contacts`
10+
url: `${environment.socketConfig.url}/contacts`,
11+
options: environment.socketConfig.opts
1112
});
1213
}
1314
}

src/environments/environment.dev.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ export const environment = {
44
baseUrl: 'http://dev.contacts.com:3000'
55
},
66
socketConfig: {
7-
url: 'http://dev.contacts.com:3000'
7+
url: 'http://dev.contacts.com:3000',
8+
opts: {
9+
transports: ['websocket']
10+
}
811
}
912
};

src/environments/environment.local.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ export const environment = {
44
baseUrl: 'http://localhost:3000'
55
},
66
socketConfig: {
7-
url: 'http://localhost:3000'
7+
url: 'http://localhost:3000',
8+
opts: {
9+
transports: ['websocket']
10+
}
811
}
912
};

src/environments/environment.prod.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ export const environment = {
44
baseUrl: 'http://api.example.com'
55
},
66
socketConfig: {
7-
url: 'http://dev.contacts.com:3000'
7+
url: 'http://dev.contacts.com:3000',
8+
opts: {
9+
transports: ['websocket']
10+
}
811
}
912
};

src/environments/environment.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ export const environment = {
88
baseUrl: 'http://localhost:3000'
99
},
1010
socketConfig: {
11-
url: 'http://localhost:3000'
11+
url: 'http://localhost:3000',
12+
opts: {
13+
transports: ['websocket']
14+
}
1215
}
1316
};
1417

0 commit comments

Comments
 (0)