Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Events push sample
Gosu Groovy JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
grails-app removed namespace from call since in events-push 1.0.M2 is added by d…
web-app
README.md no message
application.properties + application.properties
sshot.png

README.md

events-push-sample

This is a simple grails sample project depending on the following plugins:

Event binding in browser

The view eventTesting/index.gsp binds the bagsUpdated topic:

    try {
         var grailsEvents = new grails.Events("${createLink(uri:'')}",{transport:"sse"});
         grailsEvents.on('bagsUpdated', function(data){
             ...
         });
    } catch (error) {
        console.log("ERROR: " + error.toString());
    }

and triggers via AJAX

    $(function(){
            // Call controller method that emits event when its done
            $.ajax({
                url: "${createLink(action:'updateBags')}",  
            ...

the controller method firing the bagsUpdated event

    class EventTestingController {
        ...

        def updateBags(){
            Thread.sleep(5000)
            event topic: 'bagsUpdated'
            render "OK"
        }
    }
Something went wrong with that request. Please try again.