Ktor Client Engine for Karoo
Hey, while playing around with the karoo-ext SDK I came up with the idea to connect the KarooSystemService with a custom Ktor Http Client Engine in order to use it for existing ktor-based libraries. As a side effect, this makes it easier to do http requests via the companion app.
Link: https://github.com/jonasfranz/ktor-client-karoo
Feel free to leave a feedback.
-
Great idea, thanks for posting it.
I recently implemented a simple OAuth client that uses the KarooSystemService's http api for an extension. Using the proven Ktor (oauth) library via your client engine sounds like the better approach that requires less code, so I'll probably switch.
-
@timklge I'm currently using it for OAuth too, works well so far. The only limitations I came across are that the request and response is limited to 100 KB by the Karoo System Service and for OAuth2 that the authorization takes place in the browser which does not use the bluetooth connection.
-
I also encountered the issue with the browser not using the Bluetooth connection, but transferring responses bigger than 100 KB seems to work fine.
However, it is slower than I hoped for and not designed for interactivity. I prototyped an extension that uses the spotify web api to provide media player controls, and all requests tunneled through the companion app take more than 2 seconds, often about 5. Transferring a 70 KB 300x300 JPEG thumbnail takes up to 20 seconds, during which no other http requests go through because they are processed sequentially.
-
Nice, I've pushed my current state to github at https://github.com/timklge/karoo-spotify and was hoping to reach a stable state within a few weeks, and then submit it to Spotify for review so that oauth works for all users.
Unfortunately, both approaches I've tried so far (web api, spotify android sdk with spotify sideloaded directly sideloaded onto the Karoo) do have their downsides. Volume control via web api is not possible for android and iOS devices :(
Please sign in to leave a comment.
Comments
6 comments