Server does not raise pubMsg internal event
-
cemuzunlar
- Posts: 47
- Joined: 26 Dec 2008, 00:45
- Contact:
Server does not raise pubMsg internal event
"handleInternalEvent" is not called by server when a client sends a public message.
* Server logs shows that it is taking the pubMsg request from the client.
* zone.setPrivMsgInternalEvent(true); is called in the extensions init function.
* Server logs shows that it is taking the pubMsg request from the client.
* zone.setPrivMsgInternalEvent(true); is called in the extensions init function.
Cem Uzunlar
Infosfer Game and Visualization Technologies
http://www.infosfer.com
contact@infosfer.com
Infosfer Game and Visualization Technologies
http://www.infosfer.com
contact@infosfer.com
Code: Select all
zone.setPrivMsgInternalEvent(true)In order for public messages events to be fired you should call:
Code: Select all
zone.setPubMsgInternalEvent(true)-
cemuzunlar
- Posts: 47
- Joined: 26 Dec 2008, 00:45
- Contact:
Oh sorry. We already specified both of them because we need to handle both pubMsg and privMsg. I copy pasted the wrong one here.
privMsg is working but putMsg is not.
privMsg is working but putMsg is not.
Cem Uzunlar
Infosfer Game and Visualization Technologies
http://www.infosfer.com
contact@infosfer.com
Infosfer Game and Visualization Technologies
http://www.infosfer.com
contact@infosfer.com
-
cemuzunlar
- Posts: 47
- Joined: 26 Dec 2008, 00:45
- Contact:
Server version: 1.6.6
Extension language code is written in Java.
Extension language code is written in Java.
Code: Select all
public void init() {
helper = ExtensionHelper.instance();
zone = helper.getZone(this.getOwnerZone());
zone.setPubMsgInternalEvent(true);
zone.setPrivMsgInternalEvent(true);
}
public void handleInternalEvent(InternalEventObject ieo) {
trace("handleInternalEvent " + ieo.getEventName());
}
Cem Uzunlar
Infosfer Game and Visualization Technologies
http://www.infosfer.com
contact@infosfer.com
Infosfer Game and Visualization Technologies
http://www.infosfer.com
contact@infosfer.com
-
cemuzunlar
- Posts: 47
- Joined: 26 Dec 2008, 00:45
- Contact:
Did you have a chance to investigate the issue?
Cem Uzunlar
Infosfer Game and Visualization Technologies
http://www.infosfer.com
contact@infosfer.com
Infosfer Game and Visualization Technologies
http://www.infosfer.com
contact@infosfer.com
Yes, and it works as expected.
The problem is probably somewhere else. A couple of suggestions:
1. make sure the extension is really used by the Zone your application connects to (e.g. trace some text in the init and verify it's outputted correctly when the server starts)
2. make sure there's no zone name mismatch (i.e. the client is connecting to that Zone)
The problem is probably somewhere else. A couple of suggestions:
1. make sure the extension is really used by the Zone your application connects to (e.g. trace some text in the init and verify it's outputted correctly when the server starts)
2. make sure there's no zone name mismatch (i.e. the client is connecting to that Zone)
-
cemuzunlar
- Posts: 47
- Joined: 26 Dec 2008, 00:45
- Contact:
1-2) This problem appears in a big project and everything else is working well.
The server got the message from the client
<msg t='sys'><body action='pubMsg' r='8'><txt><![CDATA[test]]></txt></body></msg>
but it doesn't raise the handleInternalEvent. I also tried setting the
zone.setPubMsgInternalEvent(false);
With this setting, server should be broadcasting the message to all users in the room including the sender but server didn't send out any messages when it got the message:
<msg t='sys'><body action='pubMsg' r='8'><txt><![CDATA[test]]></txt></body></msg>
it is acting like we disabled the sendPublicMessage with
<DisabledSysActions>
<action>sendPublicMessage</action>
</DisabledSysActions>
but we didn't.
The server got the message from the client
<msg t='sys'><body action='pubMsg' r='8'><txt><![CDATA[test]]></txt></body></msg>
but it doesn't raise the handleInternalEvent. I also tried setting the
zone.setPubMsgInternalEvent(false);
With this setting, server should be broadcasting the message to all users in the room including the sender but server didn't send out any messages when it got the message:
<msg t='sys'><body action='pubMsg' r='8'><txt><![CDATA[test]]></txt></body></msg>
it is acting like we disabled the sendPublicMessage with
<DisabledSysActions>
<action>sendPublicMessage</action>
</DisabledSysActions>
but we didn't.
Cem Uzunlar
Infosfer Game and Visualization Technologies
http://www.infosfer.com
contact@infosfer.com
Infosfer Game and Visualization Technologies
http://www.infosfer.com
contact@infosfer.com
Sorry which setting?With this setting, server should be broadcasting the message to all users in the room including the sender but server didn't send out any messages when it got the message:
<msg t='sys'><body action='pubMsg' r='8'><txt><![CDATA[test]]></txt></body></msg>
A public message is always sent to all users in the room, including the sender, regardless of any settings.
The fact that a public message doesn't go through sounds really really strange to me. It's a very basic request and there's no know bug. I am inclined to think that there's some other problem going on which prevent the message to get to its destination.
1st of all I'd recommend to see if the server is spitting out any errors when the message is sent. Another thing to check is making sure that the Room is not of type "Limbo" which suppresses any broadcast-type message.
-
cemuzunlar
- Posts: 47
- Joined: 26 Dec 2008, 00:45
- Contact:
if we set the zone.setPubMsgInternalEvent(true) then, when a client uses sendPublicMessage, the server will raise the handleInternalEvent with the pubMsg command instead of immediately dispatching it to the users in the room.Lapo wrote:Sorry which setting?
A public message is always sent to all users in the room, including the sender, regardless of any settings.
We can then handle the command and if we want, we can use extensionHelper's dispatchPublicMessage method to dispatch the processed public message to the users in the room.
Server just shows that it received the message. No exception occurs.Lapo wrote:1st of all I'd recommend to see if the server is spitting out any errors when the message is sent. Another thing to check is making sure that the Room is not of type "Limbo" which suppresses any broadcast-type message.
When we checked the room settings in the Admin panel, everything seems ok. isGame = true, isLimbo = false.
The room is created with the following code:
Code: Select all
HashMap<String, String> params = new HashMap<String, String>();
params.put("name", jsRequestedRoom.getDbId());
params.put("maxU", jsRequestedRoom.getMaxUsers());
params.put("maxS", "0");
params.put("isGame", "true");
params.put("isLimbo", "false");
params.put("uCount", "false");
try {
sfsNewRoom = s.getHelper().createRoom(s.getZone(), params, jsRequesterUser.getSfsUser(), false, false);
} catch (ExtensionHelperException e) {
e.printStackTrace();
}
Last edited by cemuzunlar on 15 Jun 2009, 15:56, edited 1 time in total.
Cem Uzunlar
Infosfer Game and Visualization Technologies
http://www.infosfer.com
contact@infosfer.com
Infosfer Game and Visualization Technologies
http://www.infosfer.com
contact@infosfer.com
I am confusedif we set the zone.setPubMsgInternalEvent(false) then, when a client uses sendPublicMessage, the server will raise the handleInternalEvent with the pubMsg command instead of immediately dispatching it to the users in the room.
zone.setPubMsgInternalEvent(false) turns OFF any server side events and messages are immediately broadcasted to all clients
zone.setPubMsgInternalEvent(true) turns ON the server side events and messages are not dispatched immediately. They are first sent to the Zone extension which in turn will need decide what to do.
From your report it seems the opposite, but there's no bug like this as far as I can see.
I have a very simple Java extension that I used for testing:
Code: Select all
package test;
import java.util.*;
import it.gotoandplay.smartfoxserver.data.Room;
import it.gotoandplay.smartfoxserver.data.User;
import it.gotoandplay.smartfoxserver.data.Zone;
import it.gotoandplay.smartfoxserver.events.InternalEventObject;
import it.gotoandplay.smartfoxserver.exceptions.ExtensionHelperException;
import it.gotoandplay.smartfoxserver.exceptions.LoginException;
import it.gotoandplay.smartfoxserver.extensions.*;
import it.gotoandplay.smartfoxserver.lib.ActionscriptObject;
public class PubMsgTest extends AbstractExtension
{
private Zone zone;
private ExtensionHelper helper;
public void init()
{
helper = ExtensionHelper.instance();
zone = helper.getZone(this.getOwnerZone());
zone.setPubMsgInternalEvent(true);
}
public void destroy()
{
//
}
public void handleRequest(String cmd, ActionscriptObject ao, User u, int fromRoom)
{
//
}
public void handleRequest(String cmd, String params[], User u, int fromRoom)
{
//
}
public void handleInternalEvent(InternalEventObject ieo)
{
trace("handleInternalEvent " + ieo.getEventName());
}
}Try this simple extension in a separate Zone and see if it works for you ... if it doesn't I'll be surprised.
-
sumeetparmar
- Posts: 5
- Joined: 01 May 2009, 08:20
pubMsg not being received
This is not working for me as well. Steps:
1. init(), zone.setPubMsgInternalEvent(true);
2. handleInternalEvent(), trace(event.getEventName());
I should see the pubMsg event name in the wrapper log file but I don't and the public messages which were working before are not being transmitted i.e. the basic chat is not working -- very strange. Other events like userJoin etc are fine. The room is created ok and sendObject() works fine from AS3. Here's the code:
Insights?
-Sumeet
[/code]
1. init(), zone.setPubMsgInternalEvent(true);
2. handleInternalEvent(), trace(event.getEventName());
I should see the pubMsg event name in the wrapper log file but I don't and the public messages which were working before are not being transmitted i.e. the basic chat is not working -- very strange. Other events like userJoin etc are fine. The room is created ok and sendObject() works fine from AS3. Here's the code:
Code: Select all
public void init() {
Zone zone = ExtensionHelper.instance().getZone(this.getOwnerZone());
zone.setPubMsgInternalEvent(true);
}
public void handleInternalEvent(InternalEventObject event) {
String eventName = event.getEventName();
trace("eventName = " + eventName);
}
-Sumeet
[/code]
-
sumeetparmar
- Posts: 5
- Joined: 01 May 2009, 08:20