class
UnsubscribeRoomGroupRequest
Unsubscribes the current user to Room-related events occurring in the specified Group.
new UnsubscribeRoomGroupRequest(groupId)
Creates a new UnsubscribeRoomGroupRequest instance. The instance must be passed to the SmartFox.send() method for the request to be executed.
This request allows the user to stop being notified of specific Room events occurring in Rooms belonging to the unsubscribed Group.
If the operation is successful, the current user receives a roomGroupUnsubscribe event; otherwise the roomGroupUnsubscribeError event is fired.
Example
This example makes the current user unsubscribe a Group.
function someMethod()
{
sfs.addEventListener(SFS2X.SFSEvent.ROOM_GROUP_UNSUBSCRIBE, onGroupUnsubscribed, this);
sfs.addEventListener(SFS2X.SFSEvent.ROOM_GROUP_UNSUBSCRIBE_ERROR, onGroupUnsubscribeError, this);
// Unsubscribe the "cardGames" group
sfs.send(new SFS2X.UnsubscribeRoomGroupRequest("cardGames"));
}
function onGroupUnsubscribed(evtParams)
{
console.log("Group unsubscribed: " + evtParams.groupId);
}
function onGroupUnsubscribeError(evtParams)
{
console.log("Group unsubscribing failed: " + evtParams.errorMessage);
}
Parameter
Name | Type | Optional | Description |
---|---|---|---|
groupId |
|
|
The name of the Room Group to unsubscribe. |