Skip to content

Commit

Permalink
feat:增加websocket消息大小限制配置项 #2829
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoxuwan committed Dec 6, 2024
1 parent 53198cd commit 59eceaf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@ import org.springframework.boot.context.properties.ConfigurationProperties
data class WebSocketProperties(
var cacheLimit: Int = 3600,
var minThread: Int = 8,
var transfer: Boolean = false
var transfer: Boolean = false,
var messageSizeLimit: Int = 8*1024*1024,
var sendTimeLimit: Int = 10*1000,
var sendBufferSizeLimit: Int = 1024*1024,
)
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ class WebsocketConfiguration(

override fun configureWebSocketTransport(registration: WebSocketTransportRegistration) {
registration.addDecoratorFactory(wsHandlerDecoratorFactory())
registration.setMessageSizeLimit(webSocketProperties.messageSizeLimit)
registration.setSendTimeLimit(webSocketProperties.sendTimeLimit)
registration.setSendBufferSizeLimit(webSocketProperties.sendBufferSizeLimit)
super.configureWebSocketTransport(registration)
}

Expand Down

0 comments on commit 59eceaf

Please sign in to comment.