Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/21/2019 in all areas

  1. I don't really follow you here. There isn't any concurrency in the script, is there? So what's the difference to regular synchronous code? You are right there there is not much concurrency here. None of the I/O I'm doing (or currently expect to do) with the websocket would be expected to take very long. However, there is potentially some overlapping I/O going on here. The way the GPMDP websocket API works is that there is a near constant stream of data (presuming a track is actively playing, basically it is the "current time" message), and arbitrarily interleaved in that stream is the response or responses to calls that you might make. The overlapping I/O happening *could* be during the async send and the ongoing async receives going on. Again, I'm not claiming in this simple use case there is a huge gain. After all if I was writing this in sync code, I would just have a common read function that would read messages and discard the ones I wasn't currently interested in, waiting for the desired response before returning it. I am also planning on making use a few of the automatic messages sent over, namely the playlists. So those can be read and queued off until I care about them, and interacting with them would be the same whether they were already present when I go to look for them, or whether I needed to "await" a bit for them to come in. Lastly, I'm planning on pulling down the various bits of album art into a local cache to use as the icon, and that would be nice to run "concurrently". Now I'm all set to just add those pieces in! But first, I'm getting the basics all working so I can control more of my computer using Alfred!
    1 point
×
×
  • Create New...