Web Connection
NextTick( ) function to hook into event loop
Gravatar is a globally recognized avatar based on your email address. NextTick( ) function to hook into event loop
  Tom Green
  All
  Jul 2, 2026 @ 05:36am

Hi Rick. I'm using file based messaging, which (I think) uses a polling-for-messages loop to check for new messages to reply to.

I think of this as being like the event loop in windows or in a browser.

Is there any way to hook into this loop, so that I can execute a function the next time it polls for message, especially if there are no messages waiting?

  • I want to reply to the web call (API rest call) first. A bit later, when the server is idle, I would like to send an email, or maybe do some else that won't affect the response, but might take a bit longer.

This would be similar to the NEXTTICK function in Vue.Js

Thanks.

Gravatar is a globally recognized avatar based on your email address. re: NextTick( ) function to hook into event loop
  Rick Strahl
  Tom Green
  Jul 2, 2026 @ 06:40am

You can in File based messaging, but not in COM. File based uses a timer that checks for messages on disk and you can use BINDEVENT() to bind to the timer's tick events.

But... that only works in file based messaging - in COM the server just sits and waits for the next request.

You can intercept when a request comes in in the YourServer::ProcessHit() method which is the better way to probably do this, or if you need something more frequent or more consistent, run your own timer in the background.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: NextTick( ) function to hook into event loop
  Tom Green
  Rick Strahl
  Jul 2, 2026 @ 04:48pm

Thanks, Rick.

I managed to hook in my cue of events to run at idle time. Works like a charm. Now the server returns a result quickly to the API caller, and does backend tasks later when the server is idle.

© 1996-2026