Socket.io: How to change server options on runtime #4342
-
Hi Team, Currently I am using Socket.io connection in my application. Below is my server socket.io code.
Currently, I need to set "path" of the server option on runtime means dynamically. My question is below.
I would be helpful if anyone help me to solve this. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi! You can use the import { Server } from "socket.io";
const io = new Server(3000);
io.path("/myownpath/"); Reference: https://socket.io/docs/v4/server-api/#serverpathvalue For the other options, you may need to update the io.engine.opts.maxHttpBufferSize = 1e8; |
Beta Was this translation helpful? Give feedback.
Hi! You can use the
path()
method:Reference: https://socket.io/docs/v4/server-api/#serverpathvalue
For the other options, you may need to update the
opts
attribute of the underlying engine, for example: