【发布时间】:2013-10-08 00:24:16
【问题描述】:
我为我的项目尝试了以下设置,以使用事件推送插件http://grails.org/plugin/events-push向 UI 发送通知
main.gsp
----------
<html>
<head>
<r:require modules="grailsEvents"/>
<r:script>
grailsEvents.on('myTestEvent', function (data) {
alert ("Testing data recieved : "+data)
}, {});
</r:script>
</head>
</html>
MyTestController.groovy
------------------------
def testMyEvent() {
event for:'myApp' topic:'myTestEvent' data:"Testing something"
}
BuildConfig.groovy
------------------
plugins {
build ':platform-core:1.0.RC5'
build ':events-push:1.0.M7'
compile ':platform-core:1.0.RC5'
runtime ':platform-core:1.0.RC5'
compile ':events-push:1.0.M7'
runtime ':events-push:1.0.M7'
}
MyEvents.groovy (grails-app/conf)
---------------
events = {
'myTestEvent' namespace : 'myApp', browser:true, browserFilter: { message, request ->
println "myTestEvent event raised"
return true // allows browser push on this topic
}
}
最初我遇到了问题,因为 events-push 插件无法找到氛围插件。所以我不得不在 grails home (<grails_home>/lib/jars/atmosphere-0.9.0RC3 and atmosphere-1.1.0-SNAPSHOT) 下手动复制粘贴。然后它开始编译项目。但是<r:> 标记没有被编译并抛出运行时错误为Error executing tag <r:layoutResources>: No module found with name [grailsEvents]
我无法找到有关如何使其工作的适当文档。有人可以指出逐步设置此插件并使其工作的正确方法吗?
我提到了这个Grails Events Push plugin not getting a response from server event,但我仍然无法让它工作。非常感谢任何帮助!!!
【问题讨论】:
标签: grails notifications push grails-plugin gsp