I can’t really tell which wire is broken from the photo, but if the socket came out f the connector housing, you can just line it back up and slide it in. If the wire has separated from the connector and the metal socket is still in there, your going to be in for a PITA unless you have crimpers.
The connector on the left looks to be a JST-PH and the one on the right is a ZH or maybe EH. The distance between pins on a ZH is 1.5mm and EH is 2.5mm.
Both kinds have a little plastic catch you can lift to pull out the old socket. You’ll need to get the right sockets and crimp a new one on.