Stremio / stremio-addon-sdk

🧙 A Node.js SDK for creating and publishing Stremio add-ons
https://www.stremio.com/addon-sdk
MIT License
656 stars 175 forks source link

WebSockets support #301

Closed lndgalante closed 2 weeks ago

lndgalante commented 2 weeks ago

Is it possible to call a WebSocket to resolve to a subtitle objects array within builder.defineSubtitlesHandler() callback/handler function?

I tried this a few times without luck; I can get a subtitle object after ~10s, but then the subtitles icon doesn't appear on the Stremio Desktop app.

Context: I'm building a Subtitles service, and if the subtitle doesn't exists over my API/DB it will call a WebSocket server to index that movie or tv show subtitle live.

jaruba commented 2 weeks ago

this is not possible, the addon sdk works exclusively through HTTP(S)

maybe the solution for your issue is to respond with an empty subtitle array and download the subtitles in the background to cache them to disk for future requests?

lndgalante commented 5 days ago

@jaruba thanks for the reply.

Yes, that makes sense; what about doing a long POST instead of WS? I think I tried that but it didn't work, trying to think of any other alternative.