RJ
RJ3y ago

How InternalConvexClient types work

What exactly are udfPath and queryToken in e.g. https://docs.convex.dev/api/classes/browser.InternalConvexClient#subscribe ? My guess was that udfPath meant user-defined function path, which in turn I thought meant something like "myDir/myFile:myQuery". But queryToken also sounds like it could be that.
6 Replies
ballingt
ballingt3y ago
With the caveat that this client is described as "internal" because we might change these implementation details... A queryToken is meant to be an opaque handle on a subscribed query — it's how you know which queries have new values in onTransition, so you can do whatever it was you wanted to do on update of that query in particular. It's not actually opaque, it's a string you can read that contains the name of the query and the serialized. But imagine we might HMAC it one day, and build your own data structure to keep track of it.
RJ
RJOP3y ago
Gotcha, thank you! Is my interpretation of udfPath correct, then?
ballingt
ballingt3y ago
You can see an example of this in the React client https://unpkg.com/browse/convex@0.2.1/src/react/index.ts#L236
UNPKG - convex
The CDN for convex
RJ
RJOP3y ago
And of course, internal status noted 🙂
ballingt
ballingt3y ago
Yep you've got the udfPath right, it's how you specify a query or mutation function. It's a more public interface that querytoken, it's how developers specify the function.
RJ
RJOP3y ago
Sweet, thanks!

Did you find this page helpful?