Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/main/java/io/vertx/ext/stomp/StompServerConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@

import javax.net.ssl.SSLSession;

import io.vertx.codegen.annotations.CacheReturn;
import io.vertx.codegen.annotations.Fluent;
import io.vertx.codegen.annotations.GenIgnore;
import io.vertx.codegen.annotations.VertxGen;
import io.vertx.core.Handler;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.net.SocketAddress;

/**
* Class representing a connection between a STOMP client a the server. It keeps a references on the client socket,
Expand Down Expand Up @@ -97,4 +99,28 @@ public interface StompServerConnection {
*/
void configureHeartbeat(long ping, long pong, Handler<StompServerConnection> pingHandler);

/**
* @return the remote address for this connection, possibly {@code null} (e.g a server bound on a domain socket).
* If {@code useProxyProtocol} is set to {@code true}, the address returned will be of the actual connecting client.
*/
@CacheReturn
SocketAddress remoteAddress();

/**
* Like {@link #remoteAddress()} but returns the proxy remote address when {@code real} is {@code true}
*/
SocketAddress remoteAddress(boolean real);

/**
* @return the local address for this connection, possibly {@code null} (e.g a server bound on a domain socket)
* If {@code useProxyProtocol} is set to {@code true}, the address returned will be of the proxy.
*/
@CacheReturn
SocketAddress localAddress();

/**
* Like {@link #localAddress()} ()} but returns the server local address when {@code real} is {@code true}
*/
SocketAddress localAddress(boolean real);

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import io.vertx.core.impl.logging.Logger;
import io.vertx.core.impl.logging.LoggerFactory;
import io.vertx.core.net.NetSocket;
import io.vertx.core.net.SocketAddress;
import io.vertx.ext.stomp.*;

import java.util.Objects;
Expand Down Expand Up @@ -150,4 +151,24 @@ public synchronized void configureHeartbeat(long ping, long pong, Handler<StompS
}
}

@Override
public SocketAddress remoteAddress() {
return socket.remoteAddress();
}

@Override
public SocketAddress remoteAddress(boolean real) {
return socket.remoteAddress(real);
}

@Override
public SocketAddress localAddress() {
return socket.localAddress();
}

@Override
public SocketAddress localAddress(boolean real) {
return socket.localAddress(real);
}

}