-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Adjust socket options (buffer sizes) from the websocket handler #1378
Comments
To be implemented via the new |
I need to hear more about this feature. This makes sense for HTTP/1.1 Websocket because Websocket takes over the protocol and thus is in direct control of the socket. This makes no sense for HTTP/2 Websocket because there Websocket is just a normal stream. My question is how do you determine the right size for those options and can there be a more generic approach that would work both for HTTP/1.1 and HTTP/2 Websocket? Thanks. |
Sure - I'll try. This is all in the context of VerneMQ and MQTT over websockets. Often we can set some pre-defined (small) values for the sndbuf and recbuf sizes in order to not use all available memory when having thousands of MQTT devices over websockets - this is fine for most as they only send and receive small bits of data every so often. Then there are some specific MQTT clients which have much more traffic (usually due to a fan-in scenario) and hence benefits from larger values for sndbuf and recbuf. Usually we let this configuration for the specific clients come from an external source which is only queried after the MQTT websocket client has connected to VerneMQ and then VerneMQ will use check the credentials against and external database from which it may also retrieve the sndbuf and recbuf value overrides. So I guess we don't really decide the values, i.e., we've outsourced the decision to those tuning the system. Does this make sense? |
Yeah. Thanks! It just doesn't fit with |
We worked around this by implementing a |
Let's keep it open, it's useful to have but it will have to be implemented a different way. It just doesn't fit |
The proposed solution with a custom stream handler and implementing the |
There's probably a type error in |
This is a feature request.
For some of our uses cases it is important to be able to set various socket options from within a websocket handler. For example the desired sizes for some options like buffer, sndbuf, recbuf are not known when the handler is started but first later after this information has been retrieved externally after authentication.
For now the workaround exists to write a wrapper around
cowboy_websocket
which extracts the socket and adds it to the handler state.The text was updated successfully, but these errors were encountered: