JayThomason / Tutti

Tutti is a shared music application for the car being made in conjunction with Audi.
3 stars 1 forks source link

Add "broadcast" or "send message" methods to Jam #205

Closed hwray closed 10 years ago

hwray commented 10 years ago

We have a lot of repetitive places in our code where we awkwardly loop through the set of clients in the Jam to make an AsyncHttp request. We should replace these with broadcast() or sendMessage() methods in the Jam, which can be responsible for checking if master/client and taking the appropriate action.

hwray commented 10 years ago

I've added broadcastAddSong, SetSong, MoveSong, and RemoveSong methods to the Jam object. These take care of all the "if (isMaster)" logic, as well as the looping through client objects and sending/callbacks for the Async HTTP requests.