Skip to content

Ngrok Support#21

Open
davidaarmstrong wants to merge 15 commits into
rundel:masterfrom
davidaarmstrong:master
Open

Ngrok Support#21
davidaarmstrong wants to merge 15 commits into
rundel:masterfrom
davidaarmstrong:master

Conversation

@davidaarmstrong
Copy link
Copy Markdown

The main update here is adding support to direct tunneling through ngrok. The serve_file() function, now takes arguments tunnel (logical) indicating whether a tunnel to ngrok should be created and ngrok_domain, which allows you to use a custom domain if you have a paid account on ngrok.

@rundel
Copy link
Copy Markdown
Owner

rundel commented Apr 17, 2026

I made some small fixes and a couple of changes (as recommended by claude) - could you test and let me know if I broke anything or not.

@davidaarmstrong
Copy link
Copy Markdown
Author

Your changes were seemed to work. I also made a few other changes to solve the problems mentioned in one of the other issues that the functions depend on being called from within RStudio. It should work in other IDEs now.

- Wrap websocket_loop body in tryCatch so rstudioapi errors (e.g.
  stale file_id) no longer kill the update loop permanently
- Move later::later(websocket_loop, interval) outside the tryCatch so
  the loop always reschedules, even after an error
- Defer the first websocket_loop kick-off via later::later instead of
  calling it synchronously inside onWSOpen, avoiding rstudioapi calls
  from within the WebSocket handler
- Guard against sending empty file content (race between documentSave
  truncating and writing the file) in both the loop and initial send
- Add WebSocket reconnection logic in livecode.js with exponential
  back-off (1s → 30s cap) so clients survive transient disconnects

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants