News & Announcements User Community Developer Community

Welcome to the RingCentral Community

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

Search
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
[PYTHON] Timeout with websockets ConnectionClosedError: received 4300 (private use) Idle timeout expired; then sent 4300 (private use) Idle timeout expired
Tags: subscription, notifications
Jul 14, 2023 at 10:55am   •   1 replies  •  0 likes
Lenn Dolling

Trying to setup a heartbeat to keep the Notification websocket listener app that I am developing from crashing...

1689356866193.png

I am subscribing for session events and processing them in python just after time the app will fail with the above message.


I wonder what is the best way to do this... platform.refresh?


should I re-recreate the subscription on timeout vs sending a ping?


heartbeat_interval = 30  # in seconds

async def heartbeat(platform, interval):
    while True:
        try:
            platform.refresh()
        except ConnectionClosed:
            break
        await asyncio.sleep(interval)
1 Answer
answered on Jul 16, 2023 at 5:44pm  

To keep it alive, you should send a websocket ping frame. This is just a low level websocket exception that has little do to with RingCentral. (RingCentral SDK should handle this case though).

Here is how JavaScript handle it, FYI: https://github.com/ringcentral/ringcentral-extensible/blob/master/packages/extensions/ws/src/index.ts#L265


 0



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

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

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