Skip to content

Commit

Permalink
Merge pull request #6920 from ant-media/getClientIpFromWS
Browse files Browse the repository at this point in the history
Add clientIP to WebSocket Communication to use it in WebRTC
  • Loading branch information
mekya authored Jan 13, 2025
2 parents dd05244 + 07aa805 commit f946cc4
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 f946cc4

Please sign in to comment.