Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am doing a web socket communication process. I was successfully able to do the same by setting the interface and by adding the service reference without any parameters

But I need to send as below:

I have the parameter values from DB but how to pass this base address over a web socket in below Url and get the end point address.

baseaddress
https://10.10.10.1/Test/test?entityDetails= {"requestData":””, "requestkData":“ “} & entityId=”””)

Endpoint address expected:
wss://10.10.10.1/Test/test?entityDetails= {"requestData":””, "requestkData":“ “} & entityId=”””) .

What I have tried:

Interface that worked without querystring
[ServiceContract(CallbackContract = typeof(IWebSocketCallback))]
   public interface IWebSocket
   {

       [OperationContract(IsOneWay = true)]
       Task ExecandSendFinancial(string strResponseAPI);
   }

   public interface IWebSocketCallback
   {
       [OperationContract(IsOneWay = true)]
       Task OnExecandSendFinancial(string strResponseAPI);
   }


Task IWebSocket.ExecandSendFinancial(string strResponseAPI)
        {


            var callback = OperationContext.Current.GetCallbackChannel<IWebSocketCallback>();

In web.config done as below:
<pre> <host>
          <baseAddresses>
            <add baseAddress="http://localhost:53272/WebSocket.svc" />

         
          </baseAddresses>
        </host>




and in the server part
by adding the same service reference got the end point address
<endpoint address="ws://localhost:53272/WebSocket.svc"
Posted
Updated 18-Jun-18 5:56am
v2
Comments
[no name] 18-Jun-18 12:12pm    
It's all "custom" code with no reference to anything that anybody can relate to.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900