News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
ping pong using .net sdk example
Tags: webhooks
Sep 19, 2023 at 7:32am   •   2 replies  •  0 likes
Louis-Philippe Meunier

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:

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


2 Answers
answered on Sep 21, 2023 at 11:53am  

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

answered on Sep 19, 2023 at 10:15am  

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:

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

on Sep 19, 2023 at 1:29pm   •  0 likes

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.

A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

Developer Platform
Integrated Apps
App Gallery
Developer support
Games and rewards

Resource center
Product Releases
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us