Joseph Stalin knew that the US was building an atomic bomb even earlier than Harry Truman did, because Stalin had spies in the Manhattan Project and Truman, as VP, was not told about it. When at the Potsdam Conference Truman cryptically told Stalin that the US had developed a new weapon, Stalin immediately understood it meant that their weapon test, which he knew was coming up, must have been successful. So it was not a surprise that it was happening, but Stalin didn't know when it was going to be used on Japan.
Stalin was himself preparing to declare war on Japan and invade Manchuria, as he had promised the US and UK he would do. He had this operation planned for mid-August 1945. For him it was very important that this play out, because according to the agreement he made with the US and UK, if he entered the Pacific War he would get to seize some very valuable territory (the lower-half of Sakhalin island, and the Kuril Islands, both of which would give the Soviets excellent access to the Pacific Ocean).
When Hiroshima occurred, Stalin was distraught. He feared that the Japanese would surrender too quickly, before he was ready to invade. He retired to his dacha and moped alone. When it became clear that Japan was not going to immediately capitulate, he ordered his generals to accelerate the Manchuria campaign and declare war as soon as possible.
This happened at midnight (Transbaikal time) on August 8/9, getting Stalin into the Pacific War, and allowing him to later claim the territory he was owed. It also may have played a major role in the Japanese decision to surrender a few days later — it destroyed their preexisting diplomatic and military strategies and made it clear they had no options, in a way that the atomic bombs may not have.
The other thing Stalin did was to tell his own scientists that it was time for them to build their own atomic bomb, because, as he related, he didn't want the USSR to ever be in a position like Japan — vulnerable with no possibility of retaliation.
If you are asking about the broader Soviet citizens — they were told about Hiroshima, only in a very small note in the newspapers, and Nagasaki was not reported on. So the response was more muted than you might think. Stalin's regime had a tendency to not talk about nuclear weapons and to deemphasize them, in part because they didn't yet have a public "answer" to the question of how the Soviets would react to them. So they more or less publicly dismissed them. Interestingly, the Soviets allowed the publication of a (very good) translation of the Smyth Report, the official US government account of how the bombs were built, to circulate quite widely among the general public in the USSR. For Soviet citizens of a scientific bent, this was a place to get a lot of technical information about nuclear weapons, though the report does not discuss the bombing of Japan.
Anyway, for more information, Holloway's Stalin and the Bomb, and Gordin's Red Cloud at Dawn, are great books on the Soviet nuclear program and their reaction to Hiroshima. Hasegawa's Racing the Enemy also contains a lot about the Soviet invasion of Manchuria and its effect on the Japanese high command. On the Soviet Smyth Report, see my blog post from a little while back.