Kodi Community Forum

Full Version: [Javascript library] Kodi Client and Kodi RPC client.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi kodi community,

I recently revive an old project that i worked before without release it.
So i share this tool to have some comment/feedback in order to improve this library.

The kodi-client is a javascript library that help developper to perform RPC call on Kodi (via websocket or ajax).
This library is hightly configurable and come with great feature (middlewares, cache, logging)

https://github.com/instabledesign/kodi-client

Logging all the request
Image

The response was put in the cache (Local storage)
Image


Download and test the index.html and you'll see the power
Image
I have some feature in the todo list (request validation, request editor, release ultra minimalist build...).

This library was made to listen/query kodi easily.

javascript:

let kodi = Kodi.createClientRPC({uri: 'ws://localhost:9090'});
kodi.onReady.then(() => {

    // do a request (VideoLibrary.GetMovies)
    kodi.VideoLibrary.GetMovies().then(data => {
        console.log(data); // data contains the response result
    });


    // listen (Player.OnResume)
    kodi.Player.OnResume(data => {
        console.log(data);// contain the event data like playerid, file etc
    });
});


Feel free to comment.