Skip to content

Add Node.js WebSocket server example#2115

Open
kaganjd wants to merge 5 commits intomainfrom
jen/sup-338-add-websocket-server-example
Open

Add Node.js WebSocket server example#2115
kaganjd wants to merge 5 commits intomainfrom
jen/sup-338-add-websocket-server-example

Conversation

@kaganjd
Copy link
Copy Markdown
Contributor

@kaganjd kaganjd commented Apr 24, 2026

Summary

  • Adds a Node.js server example to the WebSockets doc showing how to serve HTTP and WebSocket on the same port with a single ngrok endpoint
  • Addresses a recurring support pattern (SUP-338 / ZD-65129) where users run HTTP and WebSocket on separate ports and hit ERR_NGROK_334 trying to start two tunnels

Test plan

  • Verify ngrok.com/docs/using-ngrok-with/websockets renders the new sections correctly

🤖 Generated with Claude Code

Common pattern: serve HTTP and WebSocket on the same port so a single ngrok endpoint handles both protocols.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mintlify
Copy link
Copy Markdown

mintlify Bot commented Apr 24, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
ngrok 🟢 Ready View Preview Apr 24, 2026, 11:38 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Comment thread using-ngrok-with/websockets.mdx Outdated

## 2. Create the server

HTTP and WebSocket share the same port.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot combine 24-26 into one line that says "Create a server.js file:"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 2427f70 — combined into a single "Create a server.js file:" line.

Agent-Logs-Url: https://github.com/ngrok/ngrok-docs/sessions/f5cfcec8-bcfa-46df-9dfb-65b97ea11c67

Co-authored-by: kaganjd <9204835+kaganjd@users.noreply.github.com>
@@ -6,3 +6,54 @@ description: ngrok HTTP endpoints support WebSockets without any special configu

WebSocket endpoints work through ngrok's HTTP endpoints without any changes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot add a line after this sentence that says "If you want to use WebSockets with HTTP, you only need one ngrok endpoint: you can start a server where listeners for both protocols share a single port."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 3f22611 — added the sentence after line 7.

Comment thread using-ngrok-with/websockets.mdx Outdated
server.listen(8000);
```

A single ngrok endpoint handles traffic for both protocols.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot put line 47 after line 49

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 076d6ff — moved "A single ngrok endpoint handles traffic for both protocols." to after the ## 3. Start ngrok heading.

Agent-Logs-Url: https://github.com/ngrok/ngrok-docs/sessions/cc6f7347-68a2-4610-a897-db39f2b5acc2

Co-authored-by: kaganjd <9204835+kaganjd@users.noreply.github.com>
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.

2 participants