-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixes #388 #389
fixes #388 #389
Conversation
Thank you for the PR but I see a two problems withthis approach:
What do you think? |
Thank you for your response,
When going with a new hook, how could that hook be named? pre-response? |
I am not sure I understand the idea of the pre-response hook here. When should it be invoked? Before every response that is sent by tusd? |
My usecase is that I have to pass data to the client, which is basically based on the file itself, so I have to pass data as soon as the upload is complete (and before the connection to tusd is closed obviously). My usecase would be satisfied when the hook is called once (the pre-finish hook would be/is a perfect fit), right before everything is finished. For a broader usecase it could be a hook that is called each time before data is sent to the client and I build the hook to do nothing except for the last time, but as the hook should be blocking, this could add up to some serious delay... |
I can understand the need for that. However, tus and therefore tusd (especially the hook system) has been designed with uni-directional data flow from the client to the server and not vice versa. That's why tusd has no such feature yet and I am unsure if there is good/elegant solution to implement data flow from hooks to the client at the current time. I have ideas to rework the hook system to be more powerful but there is no timeline yet.
Yes, those delays sound like a serious problem and I would like to avoid that. |
The v2 release will contain features to customize the response from tusd and set a custom body and headers: #672 |
Responses to the pre-finish hook will be passed to the client as custom header "X-pre-finish-response"