How to identify user from Web and Server as the same Visitor

I tracking user’s events through the UI.
I also want to use a Server to track at specific endpoints.

I tried doing it, but Matomo shows me the every user twice in the Visits-Real-Time- once from UI actions and once from Server (so it counter as 2 visitor and one unique visitor).

How can I combine this to 1 visit ?