Skip to content
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

file uploads support #21

Open
G3z opened this issue Aug 31, 2017 · 4 comments
Open

file uploads support #21

G3z opened this issue Aug 31, 2017 · 4 comments

Comments

@G3z
Copy link
Contributor

G3z commented Aug 31, 2017

Are uploads supported ?
absinthe plug has support for them (types)
And If you think uploads over WS are not a good idea,
would it be possible to use a more traditional REST approach maybe combining APW with something like apollo-upload-client

@G3z
Copy link
Contributor Author

G3z commented Sep 1, 2017

this medium article could be helpful

@vic
Copy link
Owner

vic commented Sep 4, 2017

Hey,

Have you tried simply sending the file content perhaps Base64 encoded ? Anyways when you use APW you are not serializing forms, somehow you need to construct the mutation query object, so why not simply put there the file content. Haven't had the need to upload files via APW myself, but this is what I'd try at first. Otherwise you can certainly expose the the very same schema via websockets and REST if you feel like using apollo-upload-client.

@harmon25
Copy link

I am using apollo client for API, over websocket - but doing file uploads via axios + multi-part form posts.

Depending on the file sizes you are dealing with; reading the file on the client, and encoding as a string can be slow - and will not be transparently chunked like when uploading a file via a post request as multipart form.

Apollo upload client is interesting, but would require the upload server - not ideal in a phoenix/elixir stack...

I would stick with handing uploads via post, and create a generic gql object to represent the file - and to pass around download URIs to the client.

You can directly modify your apollo cache with the response of a form post/upload - which integrates file metadata etc into apollo cache nicely, for it to live with the rest of your apollo data.

My thoughts anyway!

@G3z
Copy link
Contributor Author

G3z commented Sep 27, 2017

Thank you for your suggestion I'll try that asap.
I guess that's the best solution for the present but since sending blobs over websockets is possible (stackoverflow.com) I tought we could make APW feature-complete (this could require help from absinthe team)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants