How to use publisher and subscriber codes in a same script in unity3d?

Actually in the above script I ContextFactory.Instance.Init(cfp) for publisher and run it with topicPublisher.Run(context, host) and for subscriber I use ContextFactory.Instance.Init(cfp1)
and topicSubscriber.RunSUB(context1, host) But it didnt work.
Also in another attempt I run this code:
public class PUBSUB : MonoBehaviour
{
 public static string RedStatus;
 [SerializeFeild] private float threshold = 0.1f;
 [SerializeFeild] private float deadzone = 0.025f;
 public bool _isPressedRed;
 public Vector3 _stratPosRed;
 public ConfigurableJoint _jointRed;
 public UnityEvent onPressedRed, onReleasedRed;
 void Start()
 {
  _stratPosRed = transform.localPosition;
  _jointRed = GetComponent();
 }