How to send Slider Information over websocket?

Hello I am using the wesocketsharp from [here][1]

I have sliders in my environment. I want to send out the slider position information through the WebSocket to my receiver (another socket). How can I do this?

Ok as suggested, here are my game object or the sliders I have.

 public void initializeSliders(Slider[] sliderList_)
    {
        var CanvasChildren = CanvasObj.GetComponentsInChildren<Slider>();

        for (int i = 0; i < CanvasChildren.Length; i++)
        {
            if (CanvasChildren*.name == "Slider0")*

{
sliderList_[0] = CanvasChildren*;*

sliderList_[0].minValue = lowerLimit[0];
sliderList_[0].maxValue = upperLimit[0];
sliderList_[0].value = 0;
}
else if (CanvasChildren*.name == “Slider1”)*
{
sliderList_[1] = CanvasChildren*;*

sliderList_[1].minValue = lowerLimit[1];
sliderList_[1].maxValue = upperLimit[1];
sliderList_[1].value = 0;
}
else if (CanvasChildren*.name == “Slider2”)*
{
sliderList_[2] = CanvasChildren*;*

sliderList_[2].minValue = lowerLimit[2];
sliderList_[2].maxValue = upperLimit[2];
sliderList_[2].value = 0;
}
}
}
I would like to get the value of the sliders when the user manipulates them in the hololens and send it over the WebSocket. ( I am new to Unity and C#)
I am trying to follow the example documentation here in [github][2] and this [issue][3]. However, any pointers would be appreciated.
*[1]: Unity Asset Store - The Best Assets for Game Making
[2]: https://github.com/sta/websocket-sharp*_
_[3]: https://forum.unity.com/threads/websocket-sharp-on-unity.110916/*_

So this is what I did:
I create a connect function as you see below.

 public void Connect()
    {
        //Async connection.
#if UNITY_EDITOR
        Thread = new Thread(Run);
        Thread.Start();
#endif

#if !UNITY_EDITOR
        
        messageWebSocket = new MessageWebSocket();

        server = new Uri("ws://" + host + ":" + port.ToString());

        IAsyncAction outstandingAction = messageWebSocket.ConnectAsync(server);
        AsyncActionCompletedHandler aach = new AsyncActionCompletedHandler(NetworkConnectedHandler);
        outstandingAction.Completed = aach;
#endif
    }
#if !UNITY_EDITOR
    public void NetworkConnectedHandler(IAsyncAction asyncInfo, AsyncStatus status)
    {
        // Status completed is successful.
        if (status == AsyncStatus.Completed)
        {
            //Guarenteed connection
            con = true;
            
            //Creating the writer that will be repsonsible to send a message
            dataWriter = new DataWriter(messageWebSocket.OutputStream);
        }
        else
        {
            con = false;
        }
    }
#endif

and a sendservice method:

  public void SendService(string service, string args)
    {
#if UNITY_EDITOR
        if (Socket != null)
        {
            string s = CallService(service, args);
            Socket.Send(s);
        }
#endif

#if !UNITY_EDITOR
        if (messageWebSocket != null)
        {
            string s = CallService(service, args);
            dataWriter.WriteString(s);
            dataWriter.StoreAsync();
        }
#endif
    }

I have button called “Connect” which i want to use for connecting to the host ip +port , which has a method as : (I got this changestate button thingy from online source)

 public void ChangeButtonState(State newState)
    {
        State oldState = currentState;
        currentState = newState;

        if (newState > oldState)
        {
            for (int j = (int)newState; j > (int)oldState; j--)
            {
                buttonRenderer.material.SetFloat("_BlendTex0" + j, 1.0f);
            }
        }
        else
        {
            for (int j = (int)oldState; j > (int)newState; j--)
            {
                buttonRenderer.material.SetFloat("_BlendTex0" + j, 0.0f);
            }
        }
    }

So in my Update method:
I sent over my message by packing it in a string:

public void Update(){
#if UNITY_EDITOR
        //
#endif
        if (con)
        {
            communicator.ChangeButtonState(ButtonFunction.State.Selected);
        }
    
          slider_info = System.String.Format(",",sliderList[0].value.ToString(), sliderList[1].value.ToString(), sliderList[2].value.ToString(),
                    sliderList[3].value.ToString(),
                    sliderList[4].value.ToString(),
                    sliderList[5].value.ToString());
                    SendService("/holo/slider_value", slider_info); 
    
    }

con is a bool variable set to false.

I am sure I am missing out something.

  1. I certainly cant establish any connection and see slider messages on the other end of the socket that is running.
  2. I am receiving an error message when I play my unity editor, which I have not googled yet (new to C#).

Error Message:

 NullReferenceException: Object reference not set to an instance of an object  Source.Update () (at Assets/Scripts/Source.cs:54)

Kindly help.