Invitation problem
Posted: 10 May 2012, 15:48
Hi.
I want to send an invitation from the server, but on the client, nothing happens. The user enters the room, but the listeners(INVITATION) does not work
Client:
init
....
sfsClient.addEventListener(SFSEvent.INVITATION, this);
sfsClient.addEventListener(SFSEvent.INVITATION_REPLY, this);
sfsClient.addEventListener(SFSEvent.INVITATION_REPLY_ERROR, this);
...
RoomExtension extension = new RoomExtension(EXTENSION_ID, EXTENSIONS_CLASS);
SFSGameSettings settings = new SFSGameSettings("new room");
settings.setGroupId(GAME_ROOMS_GROUP_NAME);
settings.setGame(true);
settings.setMaxUsers(2);
settings.setMaxSpectators(0);
settings.setExtension(extension);
sfsClient.send(new CreateSFSGameRequest(settings));
...
room is created successfully
...
SFSObject toSend = new SFSObject();
toSend.putUtfString("user name", userName);
sfsClient.send(new ExtensionRequest("invite", toSend, sfsClient.getLastJoinedRoom()));
-------------------
Server:
invite handler
....
User recipient = getApi().getUserByName(name);
Invitation invitation = new SFSInvitation(user, recipient, GameCreationParam.WAITING_TIME);
InvitationCallback invitationCallback = new SFSGameInvitationCallback(getParentExtension().getParentRoom(), 1, true);
invitationCallback.onAccepted(invitation, new SFSObject());
invitationCallback.onRefused(invitation, new SFSObject());
invitationCallback.onExpired(invitation);
getInvitationManager().startInvitation(invitation, invitationCallback);
-----------------------------------
Help please. Thanks in advance.
I want to send an invitation from the server, but on the client, nothing happens. The user enters the room, but the listeners(INVITATION) does not work
Client:
init
....
sfsClient.addEventListener(SFSEvent.INVITATION, this);
sfsClient.addEventListener(SFSEvent.INVITATION_REPLY, this);
sfsClient.addEventListener(SFSEvent.INVITATION_REPLY_ERROR, this);
...
RoomExtension extension = new RoomExtension(EXTENSION_ID, EXTENSIONS_CLASS);
SFSGameSettings settings = new SFSGameSettings("new room");
settings.setGroupId(GAME_ROOMS_GROUP_NAME);
settings.setGame(true);
settings.setMaxUsers(2);
settings.setMaxSpectators(0);
settings.setExtension(extension);
sfsClient.send(new CreateSFSGameRequest(settings));
...
room is created successfully
...
SFSObject toSend = new SFSObject();
toSend.putUtfString("user name", userName);
sfsClient.send(new ExtensionRequest("invite", toSend, sfsClient.getLastJoinedRoom()));
-------------------
Server:
invite handler
....
User recipient = getApi().getUserByName(name);
Invitation invitation = new SFSInvitation(user, recipient, GameCreationParam.WAITING_TIME);
InvitationCallback invitationCallback = new SFSGameInvitationCallback(getParentExtension().getParentRoom(), 1, true);
invitationCallback.onAccepted(invitation, new SFSObject());
invitationCallback.onRefused(invitation, new SFSObject());
invitationCallback.onExpired(invitation);
getInvitationManager().startInvitation(invitation, invitationCallback);
-----------------------------------
Help please. Thanks in advance.