NativeScript / nativescript-background-http

Background Upload plugin for the NativeScript framework
Apache License 2.0
101 stars 50 forks source link

Documentation for session API #184

Closed cfjedimaster closed 5 years ago

cfjedimaster commented 5 years ago

Looking at the readme and I see this line repeated a few times:

var session = bghttp.session("image-upload");

However, I do not see this documented. My assumption is that:

Basically, can you add documentation for what session() means?

lini commented 5 years ago

Documenting exactly what the session constructor does is a tricky subject, since the internal implementation for Android and iOS is very different. For Android it is only used to keep track of the active sessions and to stop an upload in progress. For iOS it is passed to the native NSURLSessionConfiguration.backgroundSessionConfigurationWithIdentifier method which returns a native object with the session config.

To answer your questions: each session must have a unique identifier, but you can create more than one task and upload multiple files (at the same time) using one session. The demo applications in this repo can be used to test this behavior.

cfjedimaster commented 5 years ago

I think that's fair (that it is difficult to answer), but even this text here was helpful. I see it's closed - can it be reopened and added to the readme?

lini commented 5 years ago

Sorry, I closed the issue because the docs have already been updated and the information has been added.

cfjedimaster commented 5 years ago

Ah sorry - didn't see - thank you!