GithubHelp home page GithubHelp logo

HTTP2 support about peerflix-server HOT 16 CLOSED

SeyfSV avatar SeyfSV commented on August 22, 2024
HTTP2 support

from peerflix-server.

Comments (16)

 avatar commented on August 22, 2024 1

Ideally, this patch should just work (based on docs) but it seems like everything http2 in Node.js land is currently unstable. I'm sure there are workarounds but I don't actually intend on sending a PR for this, sorry, not that interested. So until express creates a compatibility layer around the builtin http2 request/response objects, I would leave this alone. Kodi is really to blame here, it should fallback to http/1.

Also note that the dependencies are outdated. Updating the dependencies is pretty simple when using npm-check-updates:

rm -f yarn.lock package-lock.json
yarn global add npm-check-updates # npm i -g npm-check-updates
ncu -u
yarn install --production # npm i --production
yarn audit # npm audit

You'll hit an error though, due to some middlewares no longer being shipped with express:

yarn add morgan --production # npm i --save morgan --production

Replace: express.logger('dev') -> require('morgan')('dev') in server/bin.js

If you don't won't to work on this unstable area, maybe attempt to use a http2 proxy.

Good luck 😄

from peerflix-server.

asapach avatar asapach commented on August 22, 2024

A PR is welcome.

Does Kodi require TLS? https://en.wikipedia.org/wiki/HTTP/2#Encryption

from peerflix-server.

SeyfSV avatar SeyfSV commented on August 22, 2024

I do not think so.
Kodi uses CURL library for sending such requests. In previous version CURLOPT_HTTP_VERSION was CURL_HTTP_VERSION_1_1, and now CURL_HTTP_VERSION_2_0.
When I provide URL from peerflix-server (non TLS) it does not return errors. It sends request, but nodejs does not response to it.
You can check this behaviour by calling perflix-server from curl with --http2 key.

from peerflix-server.

htpcforall avatar htpcforall commented on August 22, 2024

Hi SeyfSV,
I have developed an add-on in kodi to stream torrents from my server running Peerflix. Working great. Although I'm using Krypton and Jarvis. Haven't tried 18. How are you implementing the torrent streaming process? Maybe I can help. Jay

from peerflix-server.

 avatar commented on August 22, 2024

Pretty simple: https://github.com/asapach/peerflix-server/compare/master...pro-src:spdy?expand=1

from peerflix-server.

SeyfSV avatar SeyfSV commented on August 22, 2024

Hi SeyfSV,
I have developed an add-on in kodi to stream torrents from my server running Peerflix. Working great. Although I'm using Krypton and Jarvis. Haven't tried 18. How are you implementing the torrent streaming process? Maybe I can help. Jay

Hi, @htpcforall ,
Yes, you are right, with previous version all working great, but Kodi 18 use HTTP2 by default.
I just put link from /torrents/{infoHash} response to Player.play() function.

from peerflix-server.

SeyfSV avatar SeyfSV commented on August 22, 2024

Pretty simple: https://github.com/asapach/peerflix-server/compare/master...pro-src:spdy?expand=1

Hi, @pro-src ,
I checked you code, it does not work :(
Browser says "The connection was reset".
CURL returns curl: (52) Empty reply from server on both http1.1 and http2 calls.

from peerflix-server.

 avatar commented on August 22, 2024

@SeyfSV Fixed, I forgot to nest the options. I don't actually need this so I didn't test. :P

from peerflix-server.

SeyfSV avatar SeyfSV commented on August 22, 2024

@SeyfSV Fixed, I forgot to nest the options. I don't actually need this so I didn't test. :P

@pro-src HTTP2 still does not work.

curl http://localhost:9000/torrents --http2 -v
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9000 (#0)
> GET /torrents HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.58.0
> Accept: */*
> Connection: Upgrade, HTTP2-Settings
> Upgrade: h2c
> HTTP2-Settings: AAMAAABkAARAAAAAAAIAAAAA
> 
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server

from peerflix-server.

 avatar commented on August 22, 2024

Hmm... Maybe I spoke too soon. I'll let you know once I've had a chance to test this myself.

from peerflix-server.

SeyfSV avatar SeyfSV commented on August 22, 2024

@pro-src , I totally agree with you about fallback to http/1.
And we are not alone: xbmc/xbmc#16601

@asapach , I'll close this issue. Thnx!

from peerflix-server.

htpcforall avatar htpcforall commented on August 22, 2024

Hi SeyfSV,
I have developed an add-on in kodi to stream torrents from my server running Peerflix. Working great. Although I'm using Krypton and Jarvis. Haven't tried 18. How are you implementing the torrent streaming process? Maybe I can help. Jay

Hi, @htpcforall ,
Yes, you are right, with previous version all working great, but Kodi 18 use HTTP2 by default.
I just put link from /torrents/{infoHash} response to Player.play() function.

@SeyfSV Any chance I can test your add-on? Honestly, I'm would like to see how you implemented peerflix-server. I'm hungry for any knowledge around this a I would like to improve my add-ons functionality as much as possible. I would like to see if there's a way to solve the http2 issue as well. Hope to hear back. Thanks.

from peerflix-server.

SeyfSV avatar SeyfSV commented on August 22, 2024

For info: http module supports http2 requests. Issue occurs in socket.io module, that intercepts Upgrade: h2c header and brokes connection.
As workaround I create socket Object only with transports: 'pooling' option. Yes, it disables WebSocket, but it is not critical for me.

from peerflix-server.

SeyfSV avatar SeyfSV commented on August 22, 2024

Hi, @htpcforall. I am not ready for showing my add-on :)
I wrote this simple class for interact with peerflix-server.
Also you can look on my fork of peerflix-server (branch pooling)

from peerflix-server.

SeyfSV avatar SeyfSV commented on August 22, 2024

Now HTTP2 can be disabled in Kodi:

<disablehttp2>true</disablehttp2>

https://kodi.wiki/view/Advancedsettings.xml

from peerflix-server.

timurlane avatar timurlane commented on August 22, 2024

Hi @SeyfSV I was looking into developing a kodi plugin of my own (for Matrix). Did you end up succeeding with your project? I would really like to learn how to implement this.

from peerflix-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.