mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-02 14:18:40 +00:00
[Backend][taskNotifications]] Modfied for webscoket only transport and added logs (#5730)
This commit is contained in:
parent
1d7e212e2f
commit
c4bac17b83
@ -32,7 +32,15 @@ public class WebSocketManager {
|
|||||||
"connection",
|
"connection",
|
||||||
args -> {
|
args -> {
|
||||||
SocketIoSocket socket = (SocketIoSocket) args[0];
|
SocketIoSocket socket = (SocketIoSocket) args[0];
|
||||||
String userId = socket.getInitialHeaders().get("UserId").get(0);
|
final String userId;
|
||||||
|
String tempId;
|
||||||
|
try {
|
||||||
|
tempId = socket.getInitialHeaders().get("UserId").get(0);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
tempId = socket.getInitialQuery().get("userId");
|
||||||
|
}
|
||||||
|
userId = tempId;
|
||||||
|
|
||||||
if (userId != null && !userId.equals("")) {
|
if (userId != null && !userId.equals("")) {
|
||||||
LOG.info(
|
LOG.info(
|
||||||
"Client :"
|
"Client :"
|
||||||
@ -57,6 +65,27 @@ public class WebSocketManager {
|
|||||||
allUserConnection.remove(socket.getId());
|
allUserConnection.remove(socket.getId());
|
||||||
activityFeedEndpoints.put(id, allUserConnection);
|
activityFeedEndpoints.put(id, allUserConnection);
|
||||||
});
|
});
|
||||||
|
socket.on(
|
||||||
|
"connect_error",
|
||||||
|
args1 -> {
|
||||||
|
LOG.error(
|
||||||
|
"Connection ERROR for user:"
|
||||||
|
+ userId
|
||||||
|
+ "with Remote Address :"
|
||||||
|
+ socket.getInitialHeaders().get("RemoteAddress")
|
||||||
|
+ " disconnected.");
|
||||||
|
});
|
||||||
|
socket.on(
|
||||||
|
"connect_failed",
|
||||||
|
args1 -> {
|
||||||
|
LOG.error(
|
||||||
|
"Connection failed ERROR for user:"
|
||||||
|
+ userId
|
||||||
|
+ "with Remote Address :"
|
||||||
|
+ socket.getInitialHeaders().get("RemoteAddress")
|
||||||
|
+ " disconnected.");
|
||||||
|
});
|
||||||
|
|
||||||
UUID id = UUID.fromString(userId);
|
UUID id = UUID.fromString(userId);
|
||||||
Map<String, SocketIoSocket> userSocketConnections;
|
Map<String, SocketIoSocket> userSocketConnections;
|
||||||
userSocketConnections =
|
userSocketConnections =
|
||||||
@ -65,6 +94,11 @@ public class WebSocketManager {
|
|||||||
activityFeedEndpoints.put(id, userSocketConnections);
|
activityFeedEndpoints.put(id, userSocketConnections);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
ns.on(
|
||||||
|
"error",
|
||||||
|
args -> {
|
||||||
|
LOG.error("Connection error on the server");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WebSocketManager getInstance() {
|
public static WebSocketManager getInstance() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user