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

What is proper way to terminate WebSocket proxy. We use socket.end() #1051

Open
cupuyc opened this issue Oct 23, 2024 · 0 comments
Open

What is proper way to terminate WebSocket proxy. We use socket.end() #1051

cupuyc opened this issue Oct 23, 2024 · 0 comments

Comments

@cupuyc
Copy link

cupuyc commented Oct 23, 2024

Describe the feature you'd love to see

We use socket.end() to terminate websocket proxy. Is it correct way? There is no docs for that. We suspect it causes memory leak.

We use next config to add extra auth to some target websocket server.

    const proxy = createProxyMiddleware({
        target: "ws://our.target.ws.com",
        changeOrigin: true,
        ws: true,
        on: {
            error: err => {
                console.log('WARN: http proxy error', err);
            },
            proxyReqWs: (proxyReq, req, socket) => {
				// some auth logic
				if (!auth) {
					socket.end();
				}
			},
        },
    });

Additional context (optional)

No response

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

No branches or pull requests

1 participant