Where Actions can be called
actions can be only called by client? https://docs.convex.dev/functions/actions
Actions | Convex Developer Hub
Actions can call third party services to do things such as processing a payment
6 Replies
Well, they can be scheduled on the server with
ctx.scheduler.*
-- is there something else you had in mind?
you can also call one action from another with ctx.runAction
-- though you usually shouldn't, you should just call a regular shared typescript function insteadbasically there is mutation that is called by client (create order). this should call external api and return url to client
dont see way to make it synchronously
Thanks what is the best way to inform client about external api response? Save it to the database?
This is also limitation i would like to know how to stream response from for example openAI to the client. With backend like express possible just to stream it to the client
Here's three Stack articles on that:
https://stack.convex.dev/ai-chat-with-http-streaming
https://stack.convex.dev/gpt-streaming-with-persistent-reactivity
https://stack.convex.dev/streaming-http-using-fetch
AI Chat with HTTP Streaming
By leveraging HTTP actions with streaming, this chat app balances real-time responsiveness with efficient bandwidth usage. Users receive character-by-...
GPT Streaming With Persistent Reactivity
Stream GPT responses without brittle browser-based HTTP streaming.
Multiplayer reactivity, persistence, reactivity via Convex. Using OpenAI’s Node SDK...
Streaming HTTP Responses using fetch
Learn the basics of HTTP streaming with Convex by re-implementing OpenAI's SDK using built-in fetch and async iterators. No npm dependencies needed.
Thank you