How does UploadThing onClientUploadComplete work?
I'm looking at UploadThing to see how they implemented this cool services, and I do understand most of it, but 1 thing I still can't wrap my head around... How do they trigger onClientUploadComplete ?
Steps 1-8 are pretty obvious to me.
And in step 9 I understand that my server gets the response from the UT server with the metadata... but at what point is the onClientUpdateComplete triggered?
If it triggers after step 9, how does my Next Server know that a request it received should be sent to that specific client? Does that even happen like that?
If we simplify it:
1. Client GET REQ to my server
2. My server REQ from UT and returns Presigned URL to client
3. Client uploads to S3
4. Client receives response from S3 it's complete??? (is this onClientUploadComplete?)
5. UT server returns metadata to My server /api/uploadthing via POST REQ
6. My server triggers onUploadComplete (for server)
7. Because of 6 onClientUploadComplete is triggered???
If anyone can point out the flaw in my understanding I would be thankful 🙏
0 Replies