librespot-java icon indicating copy to clipboard operation
librespot-java copied to clipboard

Run Websocket connection simultaneously to the Session connect

Open devgianlu opened this issue 4 years ago • 5 comments

With the login5 token endpoint we can save time in the startup time by requesting a token via login5 and use it to start the websocket along with the REST API, we can then start the internal Hermes connection using the same token or with username/password.

The Hermes API should be used as little as possible as it's not going to live in the future. This probably addresses #308 partially.

devgianlu avatar Feb 28 '21 11:02 devgianlu

Someone asked be earlier about loginv5, I don't suppose you've looked into it to see how the hashcash stuff is solved? Also, after opening the issue a few days back about updating the protobuf definitions, I poked around in the latest client, and a significant number of the calls that were being made over Hermes have been moved to HTTP. I'm hoping to have time to start writing things up in the coming days

sashahilton00 avatar Feb 28 '21 19:02 sashahilton00

@sashahilton00 I have indeed figured out how the hashcash is solved. Just haven't published it anywhere since it was useless for out user case until today I come up with this idea that could help in some way.

I've been inspecting the Hermes requests too, but I think all I do with Hermes in this library hasn't moved. I should probably double check all the requests I am making.

devgianlu avatar Feb 28 '21 19:02 devgianlu

@sashahilton00 I have indeed figured out how the hashcash is solved. Just haven't published it anywhere since it was useless for out use until today I come up with this idea that could help in some way.

I've been inspecting the Hermes requests too, but I think all I do with Hermes in this library hasn't moved. I should probably double check all the requests I am making.

Hi @devgianlu, maybe this is the wrong issue to ask; but can you maybe share the knowledge about the HashCash?

I’m working on a PHP application for the Spotify Artists data and I am using the proto files from this repository. Just to generate all the entities needed for the login5 API. However now I’m struggling to get the actual token since the 2nd request should contain the hashcash if I’m correct.

PouleR avatar Apr 22 '21 20:04 PouleR

@PouleR Here you go: https://github.com/librespot-org/librespot-java/blob/dev/lib/src/main/java/xyz/gianlu/librespot/core/Login5Api.java

devgianlu avatar Apr 24 '21 09:04 devgianlu

@devgianlu wow thanks a lot! I’m going to use this to port it to a PHP bundle.

Thanks! Much appreciated

PouleR avatar Apr 24 '21 13:04 PouleR