Skip to content

Errors when using uWebsockets while clients are connected and server restarts #5330

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

Open
GetThatCookie opened this issue Apr 17, 2025 · 0 comments
Labels
to triage Waiting to be triaged by a member of the team

Comments

@GetThatCookie
Copy link

Describe the bug
Hi,

at my company we are in the middle of switching from express to uWebSockets.

We use

  • Nestjs
  • Ultimate-Express
  • socket.io with attachApp
  • engine.use(sessionMiddleware) <- thats the problem... or maybe not? (express-session)

While everything works really good, there is one thing we get errors.

  1. Server starts deployment, after that clients can connect and everything works
  2. Server goes down, restarts, etc. the client browser stays open!!
  3. When Server is up again, the reconnecting begins (sessionMiddleware is called)
  4. Various errors are showing up:

Image

  1. Ok so I first thought hmm my sessionMiddleware does some bad things
  2. But after some debugging, I could fix it quite easy in uServer -> handleUpgrade

Image

  1. I had to cork the response write and upgrade
  2. I saved the header before entering the async callback

I'm sry that I cannot really give a code example for this problem.

But does this seems to be a bug or just a problem in my project?

Nice to know, I absolutely don't have any error or problems after changing these few lines.

(Re-)Connecting with engine.use and express-session middleware works like a charm.

Platform:

  • OS: [e.g. Linux, Windows, Mac]

Thanks in advance!

@GetThatCookie GetThatCookie added the to triage Waiting to be triaged by a member of the team label Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to triage Waiting to be triaged by a member of the team
Projects
None yet
Development

No branches or pull requests

1 participant