You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes#8681
* Expose `send-buffer-overflow-strategy` attribute for WebSocket XML configuration
* GH-8681: Add send-buffer-overflow-strategy to documentation
Copy file name to clipboardExpand all lines: spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/ClientWebSocketContainerParser.java
+3-1
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2014-2019 the original author or authors.
2
+
* Copyright 2014-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -33,6 +33,7 @@
33
33
* the {@code <websocket:client-container/>} element.
Copy file name to clipboardExpand all lines: spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/ServerWebSocketContainerParser.java
+3-1
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2014-2019 the original author or authors.
2
+
* Copyright 2014-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -36,6 +36,7 @@
36
36
* the {@code <websocket:server-container/>} element.
Copy file name to clipboardExpand all lines: spring-integration-websocket/src/main/resources/org/springframework/integration/websocket/config/spring-integration-websocket.xsd
Copy file name to clipboardExpand all lines: spring-integration-websocket/src/test/java/org/springframework/integration/websocket/config/WebSocketParserTests-context.xml
Copy file name to clipboardExpand all lines: spring-integration-websocket/src/test/java/org/springframework/integration/websocket/config/WebSocketParserTests.java
+9-1
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2014-2022 the original author or authors.
2
+
* Copyright 2014-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -216,26 +220,27 @@ The following listing shows the attributes available for the `<int-websocket:ser
216
220
[source,xml]
217
221
----
218
222
<int-websocket:server-container
219
-
id="" <1>
220
-
path="" <2>
221
-
handshake-handler="" <3>
222
-
handshake-interceptors="" <4>
223
-
decorator-factories="" <5>
224
-
send-time-limit="" <6>
225
-
send-buffer-size-limit="" <7>
226
-
allowed-origins=""> <8>
223
+
id="" <1>
224
+
path="" <2>
225
+
handshake-handler="" <3>
226
+
handshake-interceptors="" <4>
227
+
decorator-factories="" <5>
228
+
send-time-limit="" <6>
229
+
send-buffer-size-limit="" <7>
230
+
send-buffer-overflow-strategy="" <8>
231
+
allowed-origins=""> <9>
227
232
<int-websocket:sockjs
228
-
client-library-url="" <9>
229
-
stream-bytes-limit="" <10>
230
-
session-cookie-needed="" <11>
231
-
heartbeat-time="" <12>
232
-
disconnect-delay="" <13>
233
-
message-cache-size="" <14>
234
-
websocket-enabled="" <15>
235
-
scheduler="" <16>
236
-
message-codec="" <17>
237
-
transport-handlers="" <18>
238
-
suppress-cors="true"="" /> <19>
233
+
client-library-url="" <10>
234
+
stream-bytes-limit="" <11>
235
+
session-cookie-needed="" <12>
236
+
heartbeat-time="" <13>
237
+
disconnect-delay="" <14>
238
+
message-cache-size="" <15>
239
+
websocket-enabled="" <16>
240
+
scheduler="" <17>
241
+
message-codec="" <18>
242
+
transport-handlers="" <19>
243
+
suppress-cors="true" /> <20>
239
244
</int-websocket:server-container>
240
245
----
241
246
@@ -251,41 +256,44 @@ the WebSocket session when the corresponding HTTP session expires).
251
256
See the https://docs.spring.io/spring-session/docs/current/reference/html5/#websocket[Spring Session Project] for more information.
252
257
<6> See the same option on the <<websocket-client-container-attributes,`<int-websocket:client-container>`>>.
253
258
<7> See the same option on the <<websocket-client-container-attributes,`<int-websocket:client-container>`>>.
254
-
<8> The allowed origin header values.
259
+
<8> The WebSocket session send buffer overflow strategy
260
+
determines the behavior when a session's outbound message buffer has reached the `send-buffer-size-limit`.
261
+
See `ConcurrentWebSocketSessionDecorator.OverflowStrategy` for possible values and more details.
262
+
<9> The allowed origin header values.
255
263
You can specify multiple origins as a comma-separated list.
256
264
This check is mostly designed for browser clients.
257
265
There is nothing preventing other types of client from modifying the origin header value.
258
266
When SockJS is enabled and allowed origins are restricted, transport types that do not use origin headers for cross-origin requests (`jsonp-polling`, `iframe-xhr-polling`, `iframe-eventsource`, and `iframe-htmlfile`) are disabled.
259
267
As a consequence, IE6 and IE7 are not supported, and IE8 and IE9 are supported only without cookies.
260
268
By default, all origins are allowed.
261
-
<9> Transports with no native cross-domain communication (such as `eventsource` and `htmlfile`) must get a simple page from the "`foreign`" domain in an invisible iframe so that code in the iframe can run from a domain local to the SockJS server.
269
+
<10> Transports with no native cross-domain communication (such as `eventsource` and `htmlfile`) must get a simple page from the "`foreign`" domain in an invisible iframe so that code in the iframe can run from a domain local to the SockJS server.
262
270
Since the iframe needs to load the SockJS javascript client library, this property lets you specify the location from which to load it.
263
271
By default, it points to `https://d1fxtkz8shb9d2.cloudfront.net/sockjs-0.3.4.min.js`.
264
272
However, you can also set it to point to a URL served by the application.
265
273
Note that it is possible to specify a relative URL, in which case the URL must be relative to the iframe URL.
266
274
For example, assuming a SockJS endpoint mapped to `/sockjs` and the resulting iframe URL is `/sockjs/iframe.html`, the relative URL must start with "../../" to traverse up to the location above the SockJS mapping.
267
275
For prefix-based servlet mapping, you may need one more traversal.
268
-
<10> Minimum number of bytes that can be sent over a single HTTP streaming request before it is closed.
276
+
<11> Minimum number of bytes that can be sent over a single HTTP streaming request before it is closed.
269
277
Defaults to `128K` (that is, 128*1024 or 131072 bytes).
270
-
<11> The `cookie_needed` value in the response from the SockJs `/info` endpoint.
278
+
<12> The `cookie_needed` value in the response from the SockJs `/info` endpoint.
271
279
This property indicates whether a `JSESSIONID` cookie is required for the application to function correctly (for example, for load balancing or in Java Servlet containers for the use of an HTTP session).
272
-
<12> The amount of time (in milliseconds) when the server has not sent any messages and after which the server should
280
+
<13> The amount of time (in milliseconds) when the server has not sent any messages and after which the server should
273
281
send a heartbeat frame to the client in order to keep the connection from breaking.
274
282
The default value is `25,000` (25 seconds).
275
-
<13> The amount of time (in milliseconds) before a client is considered disconnected after not having a receiving connection (that is, an active connection over which the server can send data to the client).
283
+
<14> The amount of time (in milliseconds) before a client is considered disconnected after not having a receiving connection (that is, an active connection over which the server can send data to the client).
276
284
The default value is `5000`.
277
-
<14> The number of server-to-client messages that a session can cache while waiting for the next HTTP polling request from the client.
285
+
<15> The number of server-to-client messages that a session can cache while waiting for the next HTTP polling request from the client.
278
286
The default size is `100`.
279
-
<15> Some load balancers do not support WebSockets.
287
+
<16> Some load balancers do not support WebSockets.
280
288
Set this option to `false` to disable the WebSocket transport on the server side.
281
289
The default value is `true`.
282
-
<16> The `TaskScheduler` bean reference.
290
+
<17> The `TaskScheduler` bean reference.
283
291
A new `ThreadPoolTaskScheduler` instance is created if no value is provided.
284
292
This scheduler instance is used for scheduling heart-beat messages.
285
-
<17> The `SockJsMessageCodec` bean reference to use for encoding and decoding SockJS messages.
293
+
<18> The `SockJsMessageCodec` bean reference to use for encoding and decoding SockJS messages.
286
294
By default, `Jackson2SockJsMessageCodec` is used, which requires the Jackson library to be present on the classpath.
287
-
<18> List of `TransportHandler` bean references.
288
-
<19> Whether to disable automatic addition of CORS headers for SockJS requests.
295
+
<19> List of `TransportHandler` bean references.
296
+
<20> Whether to disable automatic addition of CORS headers for SockJS requests.
Copy file name to clipboardExpand all lines: src/reference/asciidoc/whats-new.adoc
+7
Original file line number
Diff line number
Diff line change
@@ -31,3 +31,10 @@ See <<./endpoint.adoc#endpoint-pollingconsumer, Polling Consumer>> for more info
31
31
32
32
- Java, Groovy and Kotlin DSLs have now context-specific methods in the `IntegationFlowDefinition` with a single `Consumer` argument to configure an endpoint and its handler with one builder and readable options.
33
33
See, for example, `transformWith()`, `splitWith()` in <<./dsl.adoc#java-dsl, Java DSL Chapter>>.
34
+
35
+
[[x6.2-websockets]]
36
+
=== WebSockets Changes
37
+
38
+
- For the server and client WebSocket containers, the send buffer overflow strategy is now configurable in `IntegrationWebSocketContainer` and in XML via `send-buffer-overflow-strategy`.
39
+
This strategy determines the behavior when a session's outbound message buffer has reached the configured limit.
40
+
See <<./web-sockets.adoc#websocket-client-container-attributes, WebSockets Support>> for more information.
0 commit comments