Conversation
MAKMED1337
left a comment
There was a problem hiding this comment.
Should we remove TeachBound prefixes from folders ?
Investigate is dedupe really needed.
Initial sync works when delay is added, react wants all the functions to be pure, so probably global singleton is a problem
| "scripts": { | ||
| "start": "node --env-file=.env src/host.js", | ||
| "generate-env": "node src/generate_seed.js > .env", | ||
| "test": "echo \"Error: no test specified\" && exit 1" |
| console.log('[TeachBound-host] Peer disconnected:', evt.detail.toString()); | ||
| }); | ||
|
|
||
| // Subscribe to common topics to relay messages |
There was a problem hiding this comment.
Do we really need more than 1 topic ?
| CANVAS_CLEAR: 'canvas_clear', | ||
| SNAPSHOT_REQUEST: 'snapshot_request', | ||
| SNAPSHOT_RESPONSE: 'snapshot_response', | ||
| DEBUG_HELLO: 'debug_hello', |
| export function generateMessageId() { | ||
| // crypto.randomUUID is widely supported in modern browsers and Node. | ||
| if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') { | ||
| return crypto.randomUUID(); | ||
| } | ||
| // Fallback: best-effort uniqueness for local dev. | ||
| return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`; | ||
| } |
There was a problem hiding this comment.
Can it be united with generateElementId from ids.js?
| maxConnections: 50, | ||
| minConnections: 0 | ||
| }, | ||
| // Allow connections to local/insecure addresses for development |
There was a problem hiding this comment.
I guess it should be hidden by some env flags
| ``` | ||
|
|
||
| 4. (Optional) Enable P2P collaboration in the client: | ||
| - Create `TeachBound-client/.env` (this file is intentionally ignored by git) |
There was a problem hiding this comment.
This file is not ignored?
TeachBound-client/src/App.test.js
Outdated
| process.env.REACT_APP_P2P_SIGNALING_ADDR = ''; | ||
| process.env.REACT_APP_P2P_HOST = ''; |
There was a problem hiding this comment.
console.warn
No REACT_APP_P2P_SIGNALING_ADDR (or legacy REACT_APP_P2P_HOST) set
We are returning immediately in the main
TeachBound-client/src/App.js
Outdated
| const signalingAddr = process.env.REACT_APP_P2P_SIGNALING_ADDR; | ||
| const legacyHostAddr = process.env.REACT_APP_P2P_HOST; |
There was a problem hiding this comment.
I think we should stuck to only one option, and drop the REACT_APP prefix
| * Schedule stopping the node after a delay. | ||
| * Useful for React StrictMode double-mount handling. |
There was a problem hiding this comment.
In Strict Mode, React will call your component function twice in order to [help you find accidental impurities.](https://react.dev/reference/react/useState#my-initializer-or-updater-function-runs-twice) This is development-only behavior and does not affect production. Each ref object will be created twice, but one of the versions will be discarded. If your component function is pure (as it should be), this should not affect the behavior.
https://react.dev/learn/keeping-components-pure
We are doing something wrong
|
|
||
| export const P2P_PROTOCOL_VERSION = 1; | ||
|
|
||
| export const P2P_EVENT_TYPES = Object.freeze({ |
No description provided.