Retreating to privacy during painful periods is what chronic pain people do. It cuts down on input and stimulation from others, which can be not only annoying, but an instigator for more pain. It seems easier to stay alone and retreat, but soon loneliness sets in and the tendency to become isolated becomes habitual.
When you lock yourself away in exile from a social life, a void is created that opens doors to depression. The depression feeds stress and stress feeds pain. Ultimately you become less able to cope with the race and find your personality and temperament changing. Maintaining a social life is a necessity, even if isolation is easier.
Realistically there are periods of time where people are just not helpful. You often need time alone with your thoughts and time with your body. Take those periods of time without hesitation. Plan them and feel no guilt about saying no to others who might feel the need to intrude. Give yourself and your body the quality time it needs to restore, knowing that companionship and relationships will also get specific attention as well.
Since your physical ability for social time is limited with pain, it is now important to choose the social time carefully. Take a look at who you are visiting and how the visits are affecting your body. If your body is drained and lifeless after a social visit, take a look at the visitor, length of the visit and the activity. If you are rejuvenated and full of energy, evaluate what happened to revitalize you.
You are responsible for choosing family and friends to visit who inspire the best of you. It is appropriate to say no or limit those who drain your energy and have expectations that you cannot meet while dealing with pain. Friends will not have the insight to guide your visits. You must. Keep drama out of your life and boundaries in place.