oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.02k stars 2.66k forks source link

Expose all uWS websocket options #2988

Open e3dio opened 1 year ago

e3dio commented 1 year ago

What is the problem this feature would solve?

Missing key websocket settings

What is the feature you are proposing to solve the problem?

Expose all uWS websocket options:

Settings:

closeOnBackpressureLimit
idleTimeout
maxBackpressure
maxLifetime
maxPayloadLength
sendPingsAutomatically

Events:

ping
pong
subscription

What alternatives have you considered?

No response

Jarred-Sumner commented 1 year ago

These are exposed:

e3dio commented 1 year ago

Ok just need to update the docs https://bun.sh/docs/api/websockets

Those are the main ones I wanted, the missing ones I don't need now:

e3dio commented 1 year ago

I tried:

websocket: {
   idleTimeout: 30
}

but does not seem to work. This should send the Ping automatically every 30 seconds to keep connection open. I need this to get past AWS load balancer 60 second timeout. Default websocket idleTimeout is 120 seconds. Tested with uWS.js idleTimeout: 30 and it sends ping, keeps connection open

Confirmed bun maxPayloadLength working

Jarred-Sumner commented 1 year ago

Yeah it looks like pings aren't being sent. We are propagating the flag to uWS, but there's probably more we need to do

DoKoB0512 commented 1 year ago

@Jarred-Sumner Any updates on this issue?