grails-events-push icon indicating copy to clipboard operation
grails-events-push copied to clipboard

browserFilter not working when namespace is 'browser'

Open aro1976 opened this issue 11 years ago • 2 comments

I have 2 events configured:

import org.atmosphere.cpr.AtmosphereRequest
import org.grails.plugin.platform.events.EventMessage

def eventsSecurityService = ctx.eventsSecurityService

events = {
    'message'   namespace='browser', browserFilter: { EventMessage msg, AtmosphereRequest request ->
        eventsSecurityService.checkPermission(msg, request)
    }
    'message-*' browser:true, nambrowserFilter: { EventMessage msg, AtmosphereRequest request ->
        eventsSecurityService.checkPermission(msg, request)
    }
}

where the eventsSecurityService is:

import org.atmosphere.cpr.AtmosphereRequest
import org.grails.plugin.platform.events.EventMessage

class EventsSecurityService {

    Boolean checkPermission(EventMessage msg, AtmosphereRequest request) {
        log.info "checking permission on ${msg?.data}"
        false
    }
}

when I raise an event from javascript using:

var grailsEvents = new grails.Events(grails_root);
grailsEvents.send("message", {"context": "foo", "text": "my message"});

The listener receives the message without being filtered by checkPermission, but events raised by the grails application backend are filtered as expected.

aro1976 avatar Jun 25 '13 16:06 aro1976

Maybe you are always receiving local messages when they are pushed if you´ve subscribed to them. Try it with two separate browser windows and see if the message gets filtered for the other "non-local" client.

sbuettner avatar Jun 25 '13 16:06 sbuettner

@sbuettner dear simon, actually this is not the case.

aro1976 avatar Jun 26 '13 21:06 aro1976