KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ What is the execution flow of this file

  • What is the execution flow of this file

    Posted by Laura on November 13, 2021 at 12:00 am

    I am studying the official example code from here: https://github.com/kxcontrib/websocket/blob/master/AppendixB/pubsub.q . After some research, I can get the publisher/subscriber model running and I can understand the basic idea on how the feedhandler part (i.e., this file: https://github.com/kxcontrib/websocket/blob/master/AppendixB/fh.q) works. However, I am still very confusing on how the publisher part (i.e., this file: https://github.com/kxcontrib/websocket/blob/master/AppendixB/pubsub.q) works.

    I understand that when the code is initially executed, it listens on port 5001 and it defines a few tables (trade, quote, subs) and functions (loadPage, filterSyms, getSyms, getQuotes, getTrades, sub, pub). Does it mean that the interpreter directly jumps to the end of the file, that is, these two lines:

    .z.ts:{pub each til count subs}; t 1000

    and starts something like a “main loop” in winForm development?

    Suppose my guess is right, the loop keeps calling the function pub until there aren’t any new rows in the table subs. But how does subs get any new rows in the first place?

    Laura replied 6 months, 1 week ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

Log in to reply.