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