Anthony Musgrove 195 Posted April 28, 2022 Share Posted April 28, 2022 Hi all, In reference to API calls (internal API extension within plugin), I need to get the current session Id making the requests. This is simply so after certain asynchronous tasks have been completed by the API caller session, I can send a message to the session to notify the session user that their request/operation has been completed successfully. I have all the asynchronous code written and it is working magically, but I need to update the session of the operation status, otherwise the user is left in the dark with regard to Package download/install etc. My API extension :- public class ScripterXAPI : IService, IRequiresRequest, IHasResultFactory I thought maybe 'Request' object had the information I need, I notice it has 'connectionId': //2022-04-29 03:39:19.280 Info Emby ScripterX: PACKAGE DOWNLOAD RESULT, CONNECTION ID = 0HMH97NSH59LE But I still have no idea how that would link back to the session that made the API calls in the first place. I guess if this isn't possible, is it possible to get the current session Id when making the API call, ie, the browser could send the /Api/Request via AJAX, and send through the session Id as a get variable, so then I could 'update' that sessionId once everything is completed. Thank you in advance, Anthony Link to comment Share on other sites More sharing options...
Anthony Musgrove 195 Posted April 28, 2022 Author Share Posted April 28, 2022 For example, in the dashboard, a user clicks 'Download package' button, the request is sent to the API (which all works fine, everything occurs how it should), but I need to send the session Id of the user who asked for the package to be downloaded, so that I can notify the session after its finished downloading. Thanks! Link to comment Share on other sites More sharing options...
Anthony Musgrove 195 Posted April 28, 2022 Author Share Posted April 28, 2022 and just to show, on the server, in the allocated directory, the file is downloaded successfully, however at the moment the user isn't notified when its downloaded successfully as the operation is asynchronous, and I need to be able to notify the user/session after its complete! Thank you! Link to comment Share on other sites More sharing options...
Anthony Musgrove 195 Posted April 28, 2022 Author Share Posted April 28, 2022 and obviously notify the user's session if the package fails to download, rather then just dumping it to the Emby log. I want it user friendly and in the users face. 2022-04-29 03:55:43.957 Info Emby ScripterX: Failed to download package from catalog: com.emby-scripterx.example (pkgId: 2): NotFound Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now