[SOLVED] addMessageListener with Reactor API

All Union Platform questions, comments, feature requests, and bug reports.

addMessageListener with Reactor API  

Postby fredfather » Thu 20 Oct 2011 08:19

Hi,
I have a problem while trying to send a "general" message to a reactor GUI from a server module.
Here is the server module code on RoomEvent.ADD_CLIENT event :
Code: Select all
m_ctx.getServer().sendMessage("SYSTEM", "Welcome from the server module");

Here is the flex code using the reactor API on reactor ready listener :
Code: Select all
reactor.getMessageManager().addMessageListener("SYSTEM", systemMessageListener);

and the systemMessageListener function :
Code: Select all
protected function systemMessageListener (fromClient:IClient, messageType:String, messageText:String):void {
   ...
   Alert(messageText);
   ...
         }

Please what's wrong ?
Thanks for your help
Fred
fredfather
 
Posts: 5
Joined: Wed 19 Oct 2011 16:01

Re: addMessageListener with Reactor API

Postby admin » Thu 20 Oct 2011 09:55

hi fred,
are you listening for the RoomEvent.ADD_CLIENT event in a server module or a room module?

if it's a room module, the code looks correct, so the next step is to look at the server-side and client-side logs to see what messages are being sent and received (make sure to set the log levels to DEBUG).

if it's a server module, you won't get any RoomEvent.ADD_CLIENT events, so your message will never be sent. if you want to be notified any time any client connects to the server, register for ServerEvent.CLIENT_ADDED.

colin
admin
Site Admin
 
Posts: 1
Joined: Mon 17 Oct 2011 15:19

Re: addMessageListener with Reactor API

Postby fredfather » Sat 22 Oct 2011 12:26

Hi Colin,
Here are more details about my code.
I have a server module :
Code: Select all
public boolean init(ModuleContext ctx) {
   ...
   m_ctx.getServer().addEventListener(ServerEvent.CLIENT_READY, this, "onClientReadyRequest");
   ...
}

public void onClientReadyRequest(ServerEvent evt) {
   ...
   m_ctx.getServer().sendMessage("SYSTEM", "Welcome from the server module");
   ...
}

and I have a flex module with the reactor API :
Code: Select all
private function reactorReadyListener(e:ReactorEvent):void {
   ...
   reactor.getMessageManager().addMessageListener("SYSTEM", systemMessageListener);
   ...
}

protected function systemMessageListener (fromClient:IClient, messageType:String, messageText:String):void {
   ...
   Alert(messageText);
   ...
}


The problem is that the flex code never receive the SYSTEM message.
Do I see the SYSTEM message in the logs with the debug mode ?

PS I have a java error if I use the
ServerEvent.CLIENT_ADDED
event in the server module.

Fred
fredfather
 
Posts: 5
Joined: Wed 19 Oct 2011 16:01

Re: addMessageListener with Reactor API

Postby fredfather » Mon 31 Oct 2011 06:22

Hi,

I always have a pb while trying to send a "general" message from a server module to a flex gui client using the reactor API.

Please, what is the meaning of the debug WARN message "WARN: Message (u7) received for unknown room: []Message: [SYSTEM]" ?

This warning message is generated by the following server module code :

Code: Select all
public boolean init(ModuleContext ctx) {
   ...
   m_ctx.getServer().addEventListener(ServerEvent.CLIENT_READY, this, "onClientReadyRequest");
   ...
}

public void onClientReadyRequest(ServerEvent evt) {
   ...
   m_ctx.getServer().sendMessage("SYSTEM", "Welcome from the server module");
   ...
}


Fred
fredfather
 
Posts: 5
Joined: Wed 19 Oct 2011 16:01

Re: addMessageListener with Reactor API

Postby colin » Wed 16 Nov 2011 17:56

hi fred,
we are writing a test to attempt to reproduce your issue. we'll post the result and code here when the test is done.

colin
colin
 
Posts: 232
Joined: Mon 17 Oct 2011 18:47

Re: addMessageListener with Reactor API

Postby fredfather » Sat 19 Nov 2011 10:57

Hi Colin,
I just have tried with the API version 1.1.0.1169, it's the same problem.
I'm not sure it's a union problem ... it is probably something I didn't understood about union/reactor.
Thank you for the test.
Fred
fredfather
 
Posts: 5
Joined: Wed 19 Oct 2011 16:01

Re: addMessageListener with Reactor API

Postby colin » Thu 24 Nov 2011 14:51

thanks for checking in the latest version. we're still planning to write an explicit test for this issue and post our findings here. if there is a bug involved, we'll include a fix in our next release.

colin
colin
 
Posts: 232
Joined: Mon 17 Oct 2011 18:47

Re: addMessageListener with Reactor API

Postby derek » Fri 25 Nov 2011 19:35

Hi Fred,

This is a bug which has been ticketed at: http://factory.user1.net/issues/show/569.

It is now fixed and will be part of the 1.1.1 release.

Thanks!

Derek
derek
 
Posts: 68
Joined: Mon 17 Oct 2011 19:12

Re: addMessageListener with Reactor API

Postby fredfather » Sat 26 Nov 2011 16:19

Hi Derek,
Thanks for the fix.
I'm glad that my feedback is able to contribute to the Union platform.
Fred
fredfather
 
Posts: 5
Joined: Wed 19 Oct 2011 16:01


Return to Union Platform

Online

Users browsing this forum: No registered users and 8 guests