Skip to content

Commit bcf8932

Browse files
authored
Merge pull request #289 from IndustryFusion/revert-new-4
Added options to socket client
2 parents a944eb0 + 880ab3c commit bcf8932

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

backend/src/endpoints/pgrest/pgrest.gatway.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ import { Injectable } from '@nestjs/common';
2020

2121
@WebSocketGateway({
2222
cors: {
23-
origin: '*',
23+
origin: "*", // Allow all origins (modify for security)
24+
credentials: true,
2425
},
26+
transports: ["websocket"]
2527
})
2628
@Injectable()
2729
export class PgRestGateway {

backend/src/endpoints/value-change-state/value-change-state.gateway.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ import { Injectable } from '@nestjs/common';
2020

2121
@WebSocketGateway({
2222
cors: {
23-
origin: '*',
23+
origin: "*", // Allow all origins (modify for security)
24+
credentials: true,
2425
},
26+
transports: ["websocket"],
2527
})
2628
@Injectable()
2729
export class ValueChangeStateGateway {

frontend/src/components/dashboard/machine-state-chart.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,8 @@ const MachineStateChart = () => {
586586
transports: ["websocket"],
587587
rejectUnauthorized: false, // Ignore SSL certificate validation (only for HTTPS)
588588
reconnectionAttempts: 5, // Retry if connection fails
589-
timeout: 5000 // Set connection timeout
589+
timeout: 5000, // Set connection timeout
590+
secure: true
590591
});
591592

592593
socket.on("connect", () => {

frontend/src/components/dashboard/senosor-linear-charts.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,8 @@ const CombineSensorChart: React.FC = () => {
546546
transports: ["websocket"],
547547
rejectUnauthorized: false, // Ignore SSL certificate validation (only for HTTPS)
548548
reconnectionAttempts: 5, // Retry if connection fails
549-
timeout: 5000 // Set connection timeout
549+
timeout: 5000, // Set connection timeout
550+
secure: true
550551
}
551552
);
552553
socketRef.current = socket;

0 commit comments

Comments
 (0)