How to distinguish automatic polls from user interactions?

Hi guys,

I have the requirement to let an external service know that a user interaction happened on our application.

So I had a look into the traffic happening. I saw a polling request from the frontend to the backend on specific intervals and then the normal calls, when something was pressed on the UI.

My initial idea how to accomplish this, is to use our implementation of SpringVaadinServlet. In there in the service method, I would like to check the request and distinguish between automatic request (just service them) or user interaction one (call the external service async).

At this point in time I cannot look into the payload as if I read the stream it is consumed and the real logic cannot kick in afterwards…so I thought using the content-length which should give me a pretty good indication…

But sure this is not nice…does somebody has another cool idea how to solve this more nicely?

Best
Benjamin

I have the requirement to let an external service know that a user interaction happened on our application.

It sounds like you are having external audit server recording audit log, right.

Alternative approach could be to create audit log service in your application that sends info to this server. Then you just need to add calls to your audit log method in the user actions you want to log.

The audit server we have as well. For specific user actions (changes to the underlying data etc.) → we call then this service from the business layer. This is there and works fine.

But this is more generic…really each user interaction will trigger this external service (prolonging a session). So even open another view, selecting a row…if we would catch this on a view layer or somewhere, we would need to touch a lot of code or try to make some generic class that everybody inherits from that does this. Sounds like a really decentral solution to the problem