Private Message and FindUsersRequest
Posted: 27 Sep 2015, 11:50
Dear All,
I have 2 rooms, rA and rB. I have 2 users, uA and uB. uA joins room rA and uB joins room rB. Both rooms are non-game rooms.
FIRST PROBLEM:
-----------------------
If I use the following AS3 code I get no hits back for neither of the rooms from either user:
FindUsersInSpecificRoom2("rA");
FindUsersInSpecificRoom2("rB");
function FindUsersInSpecificRoom2(roomToCheck:String)
{
sfs.addEventListener(SFSEvent.USER_FIND_RESULT, onUserFindResult);
trace("Trying to find users: "+ roomToCheck);
var exp:MatchExpression = new MatchExpression(RoomProperties.NAME,StringMatch.EQUALS,roomToCheck);
// Find the users
sfs.send(new FindUsersRequest(exp)); }
function onUserFindResult(evt:SFSEvent):void
{
trace("Users found: " + evt.params.users);
}
* Even if I change the matchecpression to: var exp:MatchExpression = new MatchExpression(RoomProperties.IS_GAME, BoolMatch.EQUALS, false)
I still get no hits back even if both the rooms are non-game rooms :/
SECOND PROBLEM:
-----------------------
When I am trying to send a private message from uA to uB using:
SendPrivateMessage("uA","test message");
function SendPrivateMessage(recipient:String,bodyOfMessage:String)
{
var recipientUser:User = sfs.userManager.getUserByName(recipient);
// Send it to SFS
sfs.send(new PrivateMessageRequest(bodyOfMessage, recipientUser.id));
}
It does not work. It's like uA and uB do not see each other. If I put both users in the same room the sending message part works OK. The FIRST PROBLEM still remains.
Thank you for all the assistance
I have 2 rooms, rA and rB. I have 2 users, uA and uB. uA joins room rA and uB joins room rB. Both rooms are non-game rooms.
FIRST PROBLEM:
-----------------------
If I use the following AS3 code I get no hits back for neither of the rooms from either user:
FindUsersInSpecificRoom2("rA");
FindUsersInSpecificRoom2("rB");
function FindUsersInSpecificRoom2(roomToCheck:String)
{
sfs.addEventListener(SFSEvent.USER_FIND_RESULT, onUserFindResult);
trace("Trying to find users: "+ roomToCheck);
var exp:MatchExpression = new MatchExpression(RoomProperties.NAME,StringMatch.EQUALS,roomToCheck);
// Find the users
sfs.send(new FindUsersRequest(exp)); }
function onUserFindResult(evt:SFSEvent):void
{
trace("Users found: " + evt.params.users);
}
* Even if I change the matchecpression to: var exp:MatchExpression = new MatchExpression(RoomProperties.IS_GAME, BoolMatch.EQUALS, false)
I still get no hits back even if both the rooms are non-game rooms :/
SECOND PROBLEM:
-----------------------
When I am trying to send a private message from uA to uB using:
SendPrivateMessage("uA","test message");
function SendPrivateMessage(recipient:String,bodyOfMessage:String)
{
var recipientUser:User = sfs.userManager.getUserByName(recipient);
// Send it to SFS
sfs.send(new PrivateMessageRequest(bodyOfMessage, recipientUser.id));
}
It does not work. It's like uA and uB do not see each other. If I put both users in the same room the sending message part works OK. The FIRST PROBLEM still remains.
Thank you for all the assistance