Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about multi thread #308

Closed
Kaspek2480 opened this issue Feb 7, 2021 · 13 comments
Closed

Question about multi thread #308

Kaspek2480 opened this issue Feb 7, 2021 · 13 comments

Comments

@Kaspek2480
Copy link

Hello, I have a problem with auth service, how could I modify code or use library to achieve better results in authorize response time? Because when I'm using 50 threads, I'm only have 6-8 response in one second. Maybe it's limited in library or something need synchronized method?

@devgianlu
Copy link
Member

The authorization happens on one thread only and there's not much optimization that can be done. One additional thread is spawned for the websocket dealer connection, but that's strictly necessary. You may want to profile your application to let me know which methods take the most.

A quick reminder:

We (the librespot-org organization and me) DO NOT encourage piracy and DO NOT support any form of downloader/recorder designed with the help of this repository and in general anything that goes against the Spotify ToS. If you're brave enough to put at risk this entire project, just don't publish it. This is meant to provide support for all those devices that are not officially supported by Spotify.

@Kaspek2480
Copy link
Author

Yeah, but maybe after some modifications authorization could happen on more than one thread thanks to ExecutorService. Is it possible?

PS
I'm not supporting or doing any piracy things in any case

@devgianlu
Copy link
Member

You can't do authentication on multiple threads simultaneously, it's a TCP socket.

@Kaspek2480
Copy link
Author

Yeah but I'm wondering why spotify mobile app using web request to authenticate

@devgianlu
Copy link
Member

I believe it's using a different API, we reverse engineered the desktop app.

@Kaspek2480
Copy link
Author

Kaspek2480 commented Feb 8, 2021

Well, it's not true i already used network traffic inspector on desktop app and it also using http request to authenticate. Could you look at it?
https://snipboard.io/0hcnkZ.jpg
https://snipboard.io/BfMTi9.jpg
https://snipboard.io/uaN1fn.jpg
https://snipboard.io/HyGLw8.jpg

@devgianlu
Copy link
Member

Oh yeah that's part of the authentication in the new clients, but not all of it. They moved a good part of the API to HTTP, but there's still stuff on the Hermes protocol which needs to authenticate via the TCP socket like the audio key.

@Kaspek2480
Copy link
Author

But that new API have the same protobuf objects?

@devgianlu
Copy link
Member

It depends, all the proto definitions needed are in the repository.

@Kaspek2480
Copy link
Author

Could you look at this http authorization? It's much more efficient than socket one

@devgianlu
Copy link
Member

The desktop client requires the socket connection anyways as of a couple of months ago. I don't know if they removed that, but they probably didn't because it's their most secure channel and they'll still use it for the audio key.

@Kaspek2480
Copy link
Author

Yeah that's right, but could you look at it? More efficient way will be better for everyone

@devgianlu
Copy link
Member

Closing in favor of #322

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants