KX Community

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

Home Forums kdb+ Is this similar to function alias? Re: What is the execution flow of this file

  • rocuinneagain

    Member
    November 15, 2021 at 12:00 am

    .z.ts is the timer function which is evaluated on intervals of the timer variable set by system command t

    In your example ‘pub’ is called for each subscriber in ‘subs’ once per second.

    To start subs has count 0 but when a new subscriber connects and subscribes they will be added.

    How the subscribers are added to that table in that demo is:

    1. websockets.html calls connect() on load of the page (code)
    2. websockets.js holds the connect() definition which shows it sends loadPage[] to the q process (code)
    3. pubsub.q holds the definition of loadPage which shows that it calls ‘sub’ (code)
    4. ‘sub’ then adds your subscriber to ‘subs’