You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| 83 | onTextData in org.atmosphere.container.TomcatWebSocketHandler
| 1145 | runWorker . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run . . . . . . . . . . in java.lang.Thread
Here are the files I changed from a standard grails 2.3.5 app:
MyEvents.groovy:
events = {
'savedTodo' namespace: 'browser', browser:true // allows browser push on this topic
}
MyService.groovy
package sandbox
import grails.transaction.Transactional
@Transactional
class MyService {
//will receive client events from 'saveTodo' topic
@grails.events.Listener(namespace='browser') saveTodo(Map data) {
println data
//...
event([namespace: 'browser', topic: 'savedTodo', data: data]) // will trigger registered browsers on 'savedTodo' topic
}
}
and index.gsp
<body>
<r:require module="grailsEvents"/>
<r:script>
var grailsEvents = new grails.Events("http://localhost:8080/sandbox");
//grailsEvents.send('saveTodo', data); //will send data to server topic 'saveTodo'
//grailsEvents.on('savedTodo', function(data){...}); //will listen for server events on 'savedTodo' topic
</r:script>
<button onclick="grailsEvents.send('saveTodo', {'key1': 'value1', 'key2': 'value2'});">Hello World</button>
</body>
Also, I set the following in my BuildConfig.groovy:
I've written a simple example based on your documentation but I cannot get it to work.
I keep getting the following exception on the server side
| Error 2014-02-08 14:16:57,862 [http-bio-8080-exec-7] ERROR http11.Http11Protocol - Error reading request, ignored
Message: null
Line | Method
->> 339 | invokeWebSocketProtocol in org.atmosphere.websocket.DefaultWebSocketProcessor
| 83 | onTextData in org.atmosphere.container.TomcatWebSocketHandler
| 1145 | runWorker . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run . . . . . . . . . . in java.lang.Thread
Here are the files I changed from a standard grails 2.3.5 app:
MyEvents.groovy:
MyService.groovy
and index.gsp
Also, I set the following in my BuildConfig.groovy:
The text was updated successfully, but these errors were encountered: