Skip to content

Commit

Permalink
Some TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
sofvanh committed Dec 29, 2024
1 parent 9702fd9 commit 60ee1b1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/src/db/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ const pool = new Pool({
connectionTimeoutMillis: 5000,
});

// TODO Fix things here so that server doesn't crash on timeout errors (does it actually happen with new socket handler?)
export const query = (text: string, params: any[]) => pool.query(text, params);
1 change: 1 addition & 0 deletions frontend/src/contexts/WebSocketContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const WebSocketProvider: React.FC<{ children: React.ReactNode }> = ({ chi
socket.connect();

// Handle reconnection authentication
// TODO Probably this should be with the other auth logic
socket.io.on('reconnect', () => {
const storedToken = localStorage.getItem('mindmeld_auth_token');
if (storedToken) {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/services/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { io, Socket } from 'socket.io-client';
const backendUrl = process.env.REACT_APP_BACKEND_URL || 'http://localhost:3001';
let socket: Socket | null = null;

// TODO Think about creating a map of socket events and simplifying all the socket code, including bringing all types to shared code
// TODO At some point I'd like a heartbeat to keep the connection alive

export const getSocket = (): Socket => {
Expand Down

0 comments on commit 60ee1b1

Please sign in to comment.