private Optional < String > findClientIdForWebSocket ( WebSocket conn ) { return clientIdToSocket . entrySet ( ) . stream ( ) . filter ( e -> e . getValue ( ) == conn ) . map ( Map . Entry :: getKey ) . findFirst ( ) ; }
Unless a client has sent a CONNECT message we will not have a client Id associated with the socket