Saturday, 15 March 2014

grails - How to dynamically create a new a Topic using Events Push plugin -



grails - How to dynamically create a new a Topic using Events Push plugin -

to create topic event need declare in conf/myevents.groovy file follows:

events = { "topicname" browser: true }

i wanting utilize server force 2 things, pushing chat messages client , pushing notifications client.

using former example, need create new topic each conversation instantiated in chat scheme @ runtime, messages can pushed each of conversation participants, along lines of

new event(topic:'anothertopicname',...)

which allow me phone call service :

import grails.events.* class myservice { def dosomething(){ ... event(topic:'anothernewtopic', data:data) } }

is there method allow me create new event topic? or there way implement using events push

i've done similar. needed show notifications based on user had logged in, set in myevents.groovy:

events = { 'newnotification_*' browser:true }

and when need send notification:

event topic:"newnotification_${userid}",data:n

then in browser can hear notifications similar this:

grailsevents.on("newnotification_"+myuser,function(data){

events grails

No comments:

Post a Comment