diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/WebSocketSession.java b/spring-websocket/src/main/java/org/springframework/web/socket/WebSocketSession.java index 00878291d21..7c3943a04e8 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/WebSocketSession.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/WebSocketSession.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -73,6 +73,12 @@ public interface WebSocketSession extends Closeable { /** * Return the address on which the request was received. + *
Note: The localAddress is not always possible to access, + * which is the case with the Standard WebSocket client. In 6.2.x + * {@link org.springframework.web.socket.client.standard.StandardWebSocketClient} + * returns an address based on the local host and the port of the target + * address (not the same as the local port). In 7.0, the same will return + * {@code null} instead. */ @Nullable InetSocketAddress getLocalAddress();