Skip to content
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

Proxy WebSocket connections with error handling #872

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Hermholtz
Copy link

Properly proxy WebSocket "upgrade" connections. Without this change any attempt to use http-server as a proxy for WebSocket does not work. The code also handles error cases when WebSocket server abruptly closes connection (or a network device dies between client and server). Other PRs fixing the same issue cause http-server to throw error and exit on WebSocket connection errors.

It's a useful addition to http-server for people developing WebSocket applications. There's no WebSocket proxy for Node.js easy to use from command line. This pull request makes http-server more versatile and helps local dev workflows.

The change is as minimal as possible, no code style changes, no whitespace changes etc. Please merge.

Relevant issues

Fixes #142.

Contributor checklist

Note: cannot provide unit tests for this change.
Note: this doesn't add any new command line options.

  • Provide tests for the changes (unless documentation-only)
  • Documented any new features, CLI switches, etc. (if applicable)
    • Server --help output
    • README.md
    • doc/http-server.1 (use the same format as other entries)
  • The pull request is being made against the master branch
Maintainer checklist
  • Assign a version triage tag
  • Approve tests if applicable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WebSockets not supported in proxy mode
1 participant