Getting Started With Google Wave Developlement

  • Published on
    16-Jan-2015

  • View
    656

  • Download
    2

DESCRIPTION

Introduction to Google Wave Gadget and and Robot APIs. Presentation given May 26, 2010 at the National Extension Technology Conference in Auburn, Alabama. War Eagle!

Transcript

  • 1. Getting Started With Google Wave Development James E. Robinson, III NC State University james.robinson@extension.orgNETC 2010

2. Google Wave v/s Google wave Wave - the Wave protocolwave - The Google wave web app 3. Wave Anatomy 4. Wavelet Anatomy 5. Wavelet Anatomy (cont.) BlipsParticipantsTagsData Documentsmetadata creator creation_time last_modified_time robot title 6. Blip Anatomy 7. Blip Anatomy (cont.)Document Annotations Children Parent (if not already) metadata creator contributors last_modified version 8. Gadgets: n, dynamic web content that can be placed on any page on the web. Gadgets can be games, mini applications, news feeds, maps or any content.See also: JavaScript on steroids. 9. Hello, World! 10. Wave Gadget API setStateCallbackgetStatesetPrivateStateCallbackgetPrivateStatesubmitDeltasetParticipantCallback 11. Gadget API Example 12.

13. var div = $('content_div'); function init() {if (wave &&wave.isInWaveContainer()) { wave.setStateCallback(stateUpdated);}}gadgets.util.registerOnLoadHandler(init); 14. function buttonClicked() { var val = wave.getState().get('count', '0'); wave.getState().submitDelta({'count': val + 1}); }function stateUpdated() { if (!wave.getState().get('count')) { div.innerHTML = "The count is 0." } else { div.innerHTML = "The count is " + wave.getState().get('count'); } } 15. // Reset value of "count" to 0function resetCounter(){wave.getState().submitDelta({'count': '0'});} 16. Gadget Hosting? 17. What To Do? if __name__ == '__main__': myRobot = robot.Robot('robot name', image_url='http://path.to/icon.png') myRobot.register_handler(events.WaveletSelfAdded,OnSelfAdded) myRobot.Run() 18. Add us a Gadget...def OnSelfAdded(event, wavelet):blip = event.blipgadget = element.Gadget(GADGET_URL)blip.append(gadget) 19. Wave Happenings wavelet_blip_createdwavelet_blip_removedwavelet_participants_changewavelet_self_addedwavelet_self_removedwavelet_title_changedwavelet_timestamp_changedwavelet_version_changed 20. Blip Happenings blip_contributors_changedblip_deletedblip_submitted - only fires onceblip_timestamp_changedblip_version_changeddocument_changed - various intervalsform_button_clicked 21. code.google.com/appengine/ downloads.html 22. Register your new application... 23. Complex mapping structureAppName: jerobins-testApplication URL: jerobins-test.appspot.comWave Address: jerobins-test@appspot.com 24. Now What?def OnBlipSubmitted(event, wavelet):blip = event.blipgadget = blip.first(element.Gadget, url=GADGET_URL)if gadget:count = gadget.get('count', '0')gadget.update_element({'count', '0'})blip.append("nCount before blip" +" changed: " + count) 25. Danger, Will Robinson!Your robot or gadget may not be the only gadget or robot on the wave. 26. Annotations 27. Robot Annotationsdef OnWaveletSelfAdded(event, wavelet):blip = event.blipblip.Annotation("my-robot/tag")def OnButtonClicked(event, wavelet):blip = event.blipannots = blip.annotationsif annots.include("my-robot/tag"):""" do MY robot stuff """ 28. Active Robot API Performing scheduled tasks (e.g. cronjobs) at specified intervalsCreating new waves within Google Wavein response to actions within Google WaveitselfResponding to outside events or servicesby updating waves or creating new ones 29. Keep on Wavin' ...