Skip to content

Commit

Permalink
Add configuration for WebSocket MaxFrameSize and MaxMessageSize
Browse files Browse the repository at this point in the history
  • Loading branch information
Domenico Briganti committed Sep 22, 2024
1 parent 2444f11 commit cc761d5
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,12 @@ public class HttpConfiguration {
@ConfigDocSection
public ProxyConfig proxy;

/**
* WebSocket Server configuration.
*/
@ConfigDocSection
public WebsocketServerConfig websocketServer;

public int determinePort(LaunchMode launchMode) {
return launchMode == LaunchMode.TEST ? testPort : port;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,9 @@ private static HttpServerOptions createHttpServerOptions(

HttpServerOptionsUtils.applyCommonOptions(options, buildTimeConfig, httpConfiguration, websocketSubProtocols);

httpConfiguration.websocketServer.maxFrameSize.ifPresent(s -> options.setMaxWebSocketFrameSize(s));
httpConfiguration.websocketServer.maxMessageSize.ifPresent(s -> options.setMaxWebSocketMessageSize(s));

return options;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package io.quarkus.vertx.http.runtime;

import java.util.Optional;

import io.quarkus.runtime.annotations.ConfigGroup;
import io.quarkus.runtime.annotations.ConfigItem;

/**
* Configure the Vert.X HTTP Server for WebSocker Server connection.
*/
@ConfigGroup
public class WebsocketServerConfig {

/**
* The maximum amount of data that can be sent in a single frame.
*
* Messages larger than this must be broken up into continuation frames.
*
* Default 65536 (from HttpServerOptions of Vert.X HttpServerOptions)
*/
@ConfigItem
public Optional<Integer> maxFrameSize;

/**
* The maximum WebSocket message size.
*
* Default 262144 (from HttpServerOptions of Vert.X HttpServerOptions)
*/
@ConfigItem
public Optional<Integer> maxMessageSize;

}

0 comments on commit cc761d5

Please sign in to comment.