0
我有一个使用grails 2.3.8版本的应用程序。我已经安装了事件推送插件来将通知从服务器推送到浏览器。我buildConfig.groovy这个样子的,SSE失败:使用事件推送插件在grails中注册事件监听器后发出的问题
plugins {
build ":tomcat:7.0.42"
compile ":events-push:1.0.M7"
}
grails.servlet.version = "3.0"
grails.tomcat.nio=true
和我鉴于听众,
try {
var grailsEvents = new grails.Events("${createLink(uri:'')}", {transport: "sse"});
grailsEvents.on('ActiveCallNotification', function (data) {
console.log("GOT recording!");
});
} catch (error) {
console.log("ERROR: " + error.toString());
}
和事件从控制器发射,
def notifyActiveCall() {
event topic: 'ActiveCallNotification',data:"hi"
}
我的事件,
events = {
'ActiveCallNotification' browser: true
}
现在,当我浏览视图哪个co ntains监听器的代码,我得到了一次又一次以下错误,
EventSource's response has a MIME type ("text/html") that is not "text/event-stream". Aborting the connection. jquery.atmosphere.js:2297
SSE failed. Downgrading to fallback transport and resending
如果我在视图注释代码则不会出现此错误和明显的事件是不是娱乐。任何帮助,将不胜感激。我正在使用chrome。
列出已安装的插件,
compile ":scaffolding:2.0.3"
compile ':cache:1.1.2'
compile ":twitter-bootstrap:3.1.1.3"
compile ':jaxrs:0.10'
compile ":quartz:1.0.1"
compile ":joda-time:1.4"
compile ":spring-security-core:2.0-RC4"
compile ":grails-melody:1.53.0"
compile ":quartz-monitor:1.0"
compile ":audit-logging:1.0.1"
compile ":executor:0.3"
runtime ":hibernate:3.6.10.13" // or ":hibernate4:4.3.5.1"
runtime ":database-migration:1.4.0"
runtime ":jquery:1.11.1"
runtime ":resources:1.2.7"
当我创建一个新的应用程序,然后相同的代码工作完美,但不是在旧的应用程序。这是否可能是由于某个插件或其他冲突? – sikander