I am having a problem in sending back a message to a client. Below is my code
JavaScript
dojox.cometd.publish('/service/getservice', { userid : _USERID, }); dojox.cometd.subscribe('/service/getservice', function( message) { alert("abc"); alert(message.data.test); }); Configuration Servlet bayeux.createIfAbsent("/service/getservice", new ConfigurableServerChannel.Initializer() { @Override public void configureChannel(ConfigurableServerChannel channel) { channel.setPersistent(true); GetListener channelListner = new GetListener(); channel.addListener(channelListner); } });
GetListener class
public class GetListener implements MessageListener { public boolean onMessage(ServerSession ss, ServerChannel sc) { SomeClassFunction fun = new SomeClassFunction; } }
SomeClassFunction
class SomeClassFunction(){ }
here i am creating a boolean variable boolean success; if it is true send a message to client which is in javascript. how to send a message back to client. i have tried this line also.
remote.deliver(getServerSession(), "/service/getservice", message, null);
but it is giving me an error on remote object and getServerSession method.