Skip to content

Commit

Permalink
keep ws client ip
Browse files Browse the repository at this point in the history
  • Loading branch information
burak-58 committed Jan 5, 2025
1 parent 60001d8 commit 5b57c99
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/io/antmedia/websocket/WebSocketCommunityHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public class WebSocketCommunityHandler {

protected String userAgent = "N/A";

protected String clientIP = "N/A";


public WebSocketCommunityHandler(ApplicationContext appContext, Session session) {
this.appContext = appContext;
this.session = session;
Expand Down Expand Up @@ -496,4 +499,12 @@ public String getUserAgent() {
public void setUserAgent(String userAgent) {
this.userAgent = userAgent;
}

public String getClientIP() {
return clientIP;
}

public void setClientIP(String clientIP) {
this.clientIP = clientIP;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,15 @@ public void testUserAgent() {
wsHandler.setUserAgent(userAgent);
assertEquals(userAgent, wsHandler.getUserAgent());
}

@Test
public void testClientIP() {
assertEquals("N/A", wsHandler.getClientIP());

String clienTIP = "a.b.c.d";
wsHandler.setClientIP(clienTIP);
assertEquals(clienTIP, wsHandler.getClientIP());
}

@Test
public void testGetSDP() {
Expand Down

0 comments on commit 5b57c99

Please sign in to comment.