Do dreams have meanings?
I had a dream that I was in a strange place and all I could see was a brilliant light.I was terrified although I knew I was in a dream. As my husband always told me that if I need help I should seek it from Imam Ali (as) I kept calling out to him (as). When i felt there was no hope, in what felt like my last breath I gasped "Oh Allah, I am afraid please wake me" I immediately felt I was awakening but before I left that place I saw what I believe was Imam Ali (as) at my right hand and then awoke. Does this dream have any meaning ?I can't seem to forget this dream, did I really see Imam Ali (as) or was it just my wish manifesting in a dream. A lot of my dreams have become reality and I feel there is some message for me in this dream.
Imam al-Baqir (A): ‘When people sleep, their spirits go out into the heaven. Whatever the spirit sees while in the heaven is true, and whatever it sees in the air [between earth and the heavens] are just muddled dreams.’
Imam al-Sadiq (A) said, ‘There are three types of dreams: glad tidings from Allah for the believer, ominous dreams from Satan, and muddled dreams.’
So, yes, some dreams have meanings (as you mention you have already experienced!)
Certainly, it is possible you saw Imam Ali (A) in a dream. Generations of people have done so before! It is also possible that you saw something else that was trying to comfort you, and it presented itself as Imam Ali (A) because that is what your mind would understand. It is really hard to know, and maybe it doesn't matter.
Usually, people dream about environments that resemble what they have seen in real life (or sometimes on television). Since this dream was about a strange place, it is possible that - as the hadith says - your soul wandered off somewhere further away from the normal realm of existence and found this frightening or difficult to understand. This happens sometimes and doesn't need to have any particular meaning (for instance, being a prediction of the future), but it does have a reality. Since it sounds like it was a particularly strong experience, perhaps this was the case.
It could also refer to something that will happen in the future, and perhaps a meaning may unfold in the coming months or even years. It sounds similar to some of what is narrated about what happens when the soul of a believer transitions to the next world, in that the believer will see Imam Ali (A) as a comforting figure, so it could also be a premonition of what that experience will be like. (I am not saying that you will die soon, only that it eventually happens to everyone, and sometimes people have dreams giving them a flash of what the afterlife, heaven, or hell are like.)
In any case, dreaming about Imam Ali (A) is a good thing and the message sounds positive! Dreams can remind us that divine assistance and intercession are ever-present realities and we are not alone in this world, and this can be a reassuring thing.