1 / 7

Talking JSON over Comet to deliver content for a network music player

Talking JSON over Comet to deliver content for a network music player. Ben Klaas Logitech Squeezebox Developer. The Squeezebox. Networked Music Player Local Music Internet Radio Podcasts Online Services (Rhapsody, Pandora, Classical.com, Last.FM, etc.). Shameless plug:

zeroun
Download Presentation

Talking JSON over Comet to deliver content for a network music player

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Talking JSON over Comet to deliver content for a network music player Ben Klaas Logitech Squeezebox Developer

  2. The Squeezebox • Networked Music Player • Local Music • Internet Radio • Podcasts • Online Services (Rhapsody, Pandora, Classical.com, Last.FM, etc.) Shameless plug: http://logitechsqueezebox.com

  3. The Client-Server Environment • Server is in Perl: Woot! • Server talks to N thin(nish) clients • New Squeezeboxes use a menu-driven GUI that is written in Lua • Need a communication layer to drive that marriage

  4. All you do to me is Talk Talk • XML is for suckers • JSON! • Polling is for suckers • Subscribe! Comet!

  5. The Basics • Perl-side sends initial top levels of client menu items (with callbacks) • Lua-side renders the menu items, registers callbacks • Item called (My Music->Albums->) • Perl does query, returns total count and first set of items • Lua continues sending requests until menu filled

  6. Subscriptions • That’s fine for Request-Response code • What about information from the server that the client needs to know about? • Server status • Player status • New home menu items • UI Feedback *

  7. A basic example • Lua: subscribe to displaystatus -- subscribe to displaystatus cmd = { 'displaystatus', 'subscribe:showbriefly' } self.slimServer.comet:subscribe( '/slim/displaystatus/' .. self.id, _getSink(self, cmd), self.id, cmd ) • Perl: registers client’s displaystatus subscription • Perl: create menu item with callback to push message through Comet displaystatus subscription • Go!

More Related