question

Louis-Philippe Meunier avatar image
Louis-Philippe Meunier asked Louis-Philippe Meunier answered

ping pong using .net sdk example

I am looking for examples on how to properly handle ping/pong requests using the .net sdk when using websockets.

Currently the sdk does not seem automatically handle this and the servers gets disconnected after some time du to inactivity.

My understanding is that after some time, the ringcentral server will send a ping frame and we need to respond (somehow) to this with a pong frame according to this documentation: https://developers.ringcentral.com/guide/notifications/websockets/heart-beats

I can`t find any examples on how to accomplish this using the .net sdk.

Thanks.

webhooks
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Tyler Liu avatar image
Tyler Liu answered Louis-Philippe Meunier commented

This should be fixed in the SDK. I am the author of the SDK and I remember that I tested this case. It is handled by this line: https://github.com/ringcentral/RingCentral.Net/blob/master/RingCentral.Net.WebSocket/WebSocketExtension.cs#L39

Could you please elaborate how to reproduce this issue? Like wait how long to have it disconnected?


1 comment
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Louis-Philippe Meunier avatar image Louis-Philippe Meunier commented ·

Hi Tyler,

Yeah it`s hard to tell exactly what is going on, we are trying to figure it out, the code is very simple.

From what we figured out so far, it does not seem to be the websocket connection not working, but instead that the subscription is not longer receiving messages.

We were able to test this by doing:

wsExtension.MessageReceived += WsExtension_MessageReceived;

And we saw that we still receive messages through the websocket. But the messages no longer make it to this part after something like 2 minutes.

var subscription = await wsExtension.Subscribe(new string[] { "/restapi/v1.0/account/~/telephony/sessions" }, async (jsonMessage) => ...

If we do a simple while loop and call: subscription.Refresh() every minute it seems like it works. But this seems to be undocumented if that is the way we are supposed to do it.

0 Likes 0 ·
Louis-Philippe Meunier avatar image
Louis-Philippe Meunier answered

@Tyler Liu can you confirm if calling subscription.Refresh() every minute manually is the right way to go?

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys