0

I have created a WebSocket server in python using the Wamp WS. I am connecting a DotNet application containing the WampSharp client with the above mentioned WebSocket server using the following code:

DefaultWampChannelFactory channelFactory = new DefaultWampChannelFactory();
channel = channelFactory.CreateChannel(serverAddress);
channel.Open();

Now I need to ping my server from the client. When I had a look at the Wamp WS client created in Python it consisted of the sendPing(self,payload) function which would ping the server as follows:

WampClientProtocol.sendPing(self, payload)

and at server side there is a onPing function which handles the ping sent as follows:

def onPing(self, payload): print "Recieved ping message successfully"

Thus, I would like to know whether there is any way I could ping the server from my WampSharp client?

WebSocket Server started at: 127.0.0.1:8000

Thanks in advance

Jason
  • 4,034
  • 4
  • 40
  • 62
Gaurang
  • 371
  • 2
  • 4
  • 21

1 Answers1

2

There is no supported way to do this currently.

Note that WampSharp wraps WebSocket4Net's WebSocket class, which by default automatically sends a ping message every 60 seconds.

I could not find any support for manual ping send in WebSocket4Net from the WebSocket class, but maybe it exists and I missed it.

If you want, you can find a different WebSocket client library that supports manual ping send, and implement a IControlledWampConnection that wraps it (see WebSocket4NetConnection), and use the DefaultWampChannelFactory overload that specifies the IControlledWampConnection to use (see WebSocket4Net extension methods).

darkl
  • 569
  • 2
  • 13
  • Hi.. Thanks a lot for the reply. Hey I would like to know then whether it is possible to achieve pinging using the android client library? – Gaurang Aug 14 '14 at 05:01
  • And also I tried pinging in dotnet client. As you said the client successfully pinged in first 60 seconds but then it did not ping. What may be the reason? – Gaurang Aug 14 '14 at 05:12
  • Actually I figured out the issue regarding the second problem and now its pinging successfully after every 60 seconds. – Gaurang Aug 14 '14 at 06:06
  • I'm not familiar with android client library. Glad you figured it out with the second issue. – darkl Aug 14 '14 at 12:02