Jesus was careful and strategic about telling people who he was. In the first year of his public ministry, he interacted with a Samaritan woman by the well in Jn 4:
25 The woman said to him, “I know that Messiah is coming (he who is called Christ). When he comes, he will tell us all things.” 26 Jesus said to her, “I who speak to you am he.”
Jesus declared to her that he was the Messiah. She, in turn, told her townspeople about Jesus.
39 Many of the Samaritans from that town believed in him because of the woman’s testimony, “He told me everything I ever did.” 40 So when the Samaritans came to him, they urged him to stay with them, and he stayed two days. 41 And because of his words many more became believers.
Jesus claimed to be the Messiah. They didn't stone him. They actually believed him.
Meanwhile, he wasn't so straightforward with the Jews.
Two years later, Mt 16:
13b He asked his disciples, “Who do people say that the Son of Man is?” 14 And they said, “Some say John the Baptist, others say Elijah, and others Jeremiah or one of the prophets.”
People were confused about Jesus' identity. Peter knew better:
15 He said to them, “But who do you say that I am?” 16 Simon Peter replied, “You are the Christ, the Son of the living God.”
Peter knew Jesus was the Son of Man, the Messiah, and the Son of God.
20 Then he strictly charged the disciples to tell no one that he was the Christ.
Jesus didn't want to advertise that he was the Messiah. Even so, they tried to stone him at least twice (Jn 8:59, 10:31, Lk 4:29) when he made some self-disclosures. He wanted to control the timing of it.
Finally, they arrested Jesus and took him to the Sanhedrin. Mt 26:
The high priest said to him, “I charge you under oath by the living God: Tell us if you are the Messiah, the Son of God.”
The high priest wanted a clear answer from Jesus.
64 “You have said so,” Jesus replied.
Jesus did not deny it.
“But I say to all of you: From now on you will see the Son of Man sitting at the right hand of the Mighty One and coming on the clouds of heaven.”
Still, Jesus humbly called himself the Son of Man.
65 Then the high priest tore his clothes and said, “He has spoken blasphemy! Why do we need any more witnesses? Look, now you have heard the blasphemy.
To them, it was blasphemy.
66 What do you think?”
“He is worthy of death,” they answered.
The consequence of calling yourself the Messiah and Son of God was death. Sure enough, they crucified Jesus the next day.
The Samaritans had no problem with Jesus calling himself the Messiah. Some Jews had a problem with Jesus implying himself to be the Messiah and Son of God and tried to stone him. Finally, the high priest would not tolerate that and demanded the death penalty. In all this, Jesus was strategic about his self-disclosure and level of publicity: how much to say and to whom.