Test queries in the browser

Is there a way to hijack the WebSocket and send messages in the network tab (or in another app) via the WebSocket without needing to code this into your app, to test your backend queries?
7 Replies
ballingt
ballingt•3mo ago
You can assign the ConvexClient to a global variable and run things like
data = await client.query("messages:list", {});
data = await client.query("messages:list", {});
in the console or if you dont' want to modify your code you can use the debugging to store it to a global varible
FleetAdmiralJakob 🗕 🗗 🗙
and with data I can do all kind of cool things then? like data.sendQuery or similar?
ballingt
ballingt•3mo ago
data is just going to be the result client is the ConvexClient
ballingt
ballingt•3mo ago
you can even reach inside the ConveClient and enumerate subscribed queries etc., but if there aren't typescript types exposed for it these are not stable APIs
FleetAdmiralJakob 🗕 🗗 🗙
sounds, good, I will definitely try this one out. Especially for security testing as I want to write some garbish or dangerous queries and this is an easy way for me to check how my queries respond

Did you find this page helpful?