#websocket server auto closed when I transfer a file about 15M

1 messages · Page 1 of 1 (latest)

sinful phoenix
#

the server return an error code 1006 with reason "Received too big message", So ,my question is the what is the maximum message size and more important , can I increase this size and how

sinful phoenix
#

any update on this?

jagged bronze
twin oarBOT
jagged bronze
#

you'll want to set that number higher

sinful phoenix
#

I will definitely try this . thanks , before that I have change most of my code to send big message through http multipart/formdata

#

is there a maximum limit on this setting? for example 100M?

sinful phoenix
#

Hi, just tested , problem still there, server close connection when I upload a 20M file. Shall I config it correctly

#

//bun websocket server
const server = Bun.serve({
maxPayloadLength: 50 * 1024 * 1204,
port: port,
fetch(req, server) {
const success = server.upgrade(req);
if (success) {
// Bun automatically returns a 101 Switching Protocols
// if the upgrade succeeds
return undefined;
}

  // handle HTTP request normally
  return new Response("Hello world!");
},
websocket: getWebsocketHandler(),

});

jagged bronze
#

maxPayloadLength goes under websocket

#

I suggest installing the bun-types npm package

#

so your text editor tells you more about what APIs are supported

sinful phoenix
#

problem solved ,thanks a lot! BTW, how to use this bun-types package. I did not see any changes in vscode

sinful phoenix
#

and additional question is compare to send big message through http multipart/formdata , is it faster or slower using websocket ?

spiral knot
spiral knot