I'm not sure if this is even the right subreddit to post this, but I feel so lost about it and would appreciate any kind of advice I can get from someone who understands what I'm dealing with.

I'm having extremely obsessive thoughts about someone and I can't stop them. No matter what I do he is just always there in my head. 

For a brief background, I started talking to him 3 years ago when I was extremely depressed, suicidal, and alone. I developed strong feelings for him and clung to the idea of us getting together. We talked for about 6 months and the feelings kept growing, during this time I also developed a very bad eating disorder, which I believe was partially triggered by the lack of control in this situation. Anyways, it was months of talking, him telling me he wasn't sure if he was ready to start a relationship, though he did have feelings for me. He ended up telling me he couldn't be with me, but wanted to remain friends. I was of course devastated and spiraled into a bad depression. We remained friendly and occasionally texted each other, but did not see each other at all. I gradually got better from being heartbroken and though I still thought about him way too often and it never stopped hurting, it was not all-consuming and I had made some process in getting over him.

Flash forward to a couple months ago, he reaches back out, we start reconnecting, and he tells me he realizes he still has feelings for me. Even with him telling me this, I remained skeptical and tried my best not to get my hopes up, but I know how he is and what was likely to happened. I think subconsciously I still did get my hopes up because, after all, this is a guy I've been in love with for 3 years. Anyways, we end hanging out and he spent the night (ill-advised). He gradually texted less and less and then eventually told me he did not want a relationship at all. He basically never reaches out to me now or responds back to my messages.

Anyways, I can rationally recognize what likely happened- he got what he wanted from me and realized he wants nothing more. But I ***cannot*** stop thinking about him. It is constant. I go to bed thinking about him and wake up thinking about him. Constantly wondering what I did wrong, how I should fix it, replaying everything that happened. It's a constant rumination and it's driving me crazy. I frequently have sobbing breakdowns about it. It's one of the most painful things I've ever felt.

Again, I'm not sure if this belong in this subreddit, but I do struggle constantly with depression, so I'm not sure if this is just a hyper-fixation my depression has created, or what, but if anyone has any advice or experience with this, I would greatly appreciate any replies.