-
Notifications
You must be signed in to change notification settings - Fork 22
Demo: Unify HTTP/WebSocket server for reverse proxy compatibility #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
kylecarbs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks!
|
fmt is my fault on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // WebSocket server attached to HTTP server (same port) | ||
| const wss = new WebSocketServer({ noServer: true }); | ||
|
|
||
| // Handle HTTP upgrade for WebSocket connections | ||
| httpServer.on('upgrade', (req, socket, head) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restore WebSocket handling in --dev mode
The WebSocket server is now attached to httpServer via noServer/on('upgrade'), but in --dev mode we never call httpServer.listen (we start Vite instead), so no upgrade requests reach this handler and the PTY WebSocket never opens. Running node demo/bin/demo.js --dev leaves the demo stuck at “Connecting…” because the WS endpoint is unreachable. The WSS needs to be wired into the dev server or keep its own listener to keep dev mode usable.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that may actually be true @kylecarbs changing PR back to DRAFT, apols!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed now!
This changes the demo server to expose the http and websocket services under the same port, so we can easily expose it using ngrok, nginx etc.