I have a sample piece of code that I'm using to exercise the Realtime Messaging Module.
Everything seems to be fine on the server side. I see log messages that the message is being sent on the assigned channel when the messaging api is used there.
Here is the server code that appears to be working (I see the following log entry: === 2011-12-01 14:21:32,391 [d-37] DEBUG ISCMessageDispatcher - sending message to channel: logTypeChannel)
public DSResponse startLogThread()
{
//create an empty DSResponse to send back to the client
DSResponse dsResponse = new DSResponse();
try
{
dsResponse.setSuccess();
//spawn the new thread and have it pump messages to a queue or subscription
new Thread(new Runnable()
{
@Override
public void run()
{
while(true)
{
try
{
Thread.sleep(1000);
ISCMessageDispatcher iscMD = ISCMessageDispatcher.instance();
iscMD.send(new ISCMessage("logTypeChannel","test message"));
}
catch(InterruptedException ie)
{
System.out.println("thread interrupted");
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
}
}).start();
}
catch(Exception ex)
{
ex.printStackTrace();
}
return dsResponse;
}
On the client I have a subscription to the same channel that the server is pushing to, but it doesn't seem to be working (the handler never gets invoked):
//subscribe to the message the the server will send to us
Messaging.subscribe("logTypeChannel",new MessagingCallback()
{
@Override
public void execute(Object o)
{
SC.say("I got a message");
}
});
I am pretty sure the subscription code performs the subscription, because the browser refreshes at regular intervals after the call is made.
Can someone point me in the right direction?
Thanks
Everything seems to be fine on the server side. I see log messages that the message is being sent on the assigned channel when the messaging api is used there.
Here is the server code that appears to be working (I see the following log entry: === 2011-12-01 14:21:32,391 [d-37] DEBUG ISCMessageDispatcher - sending message to channel: logTypeChannel)
public DSResponse startLogThread()
{
//create an empty DSResponse to send back to the client
DSResponse dsResponse = new DSResponse();
try
{
dsResponse.setSuccess();
//spawn the new thread and have it pump messages to a queue or subscription
new Thread(new Runnable()
{
@Override
public void run()
{
while(true)
{
try
{
Thread.sleep(1000);
ISCMessageDispatcher iscMD = ISCMessageDispatcher.instance();
iscMD.send(new ISCMessage("logTypeChannel","test message"));
}
catch(InterruptedException ie)
{
System.out.println("thread interrupted");
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
}
}).start();
}
catch(Exception ex)
{
ex.printStackTrace();
}
return dsResponse;
}
On the client I have a subscription to the same channel that the server is pushing to, but it doesn't seem to be working (the handler never gets invoked):
//subscribe to the message the the server will send to us
Messaging.subscribe("logTypeChannel",new MessagingCallback()
{
@Override
public void execute(Object o)
{
SC.say("I got a message");
}
});
I am pretty sure the subscription code performs the subscription, because the browser refreshes at regular intervals after the call is made.
Can someone point me in the right direction?
Thanks
Comment