TRVCamSender.JoinGroup, LeaveGroup, GetUsersFromGroup, GetGroupInfo, GetAllGroups
|Top Previous Next|
Methods working with groups on a server.
procedure JoinGroup(AGUIDGroup: TGUID; Permanent: Boolean = False;
AGroupName: TRVMAnsiString = ''; AGroupPassword: TRVMAnsiString = '';
OnlyExistingGroup: Boolean = False);
procedure LeaveGroup(GUIDGroup: TGUID);
procedure GetUsersFromGroup(GUIDGroup: TGUID; Online: Boolean);
The methods work only if this sender is connected to TRVMediaServer via the network.
A server may have several groups of clients (users). Users belonging to a group may exchange data with each other. A group is identified by an unique identifier (GUIDGroup). Groups can be used to implement chat rooms.
Joining and leaving
JoinGroup adds this sender to the group (identified by GUIDGroup) on the server. If the parameter OnlyExistingGroup = True, the user joins group only if it already exists on the server, otherwise a new group is created (if the count of groups on the server does not exceed TRVMediaServer.MaxGroupCount).
When a new user joins an existing group, all members of this group receive notifications about this new user (OnUserJoinsGroup event of their receivers).
The user can specify the group name and password. If this method creates a new group, all other users must specify the same password to join this group.
If the parameter Permanent = False, the user becomes a member of the group until he/she calls LeaveGroup, or until the connection to this client is disconnected. All other users are informed when the user leaves this group (OnUserLeavesGroup events of the receiver).
If the parameter Permanent = True, the user cannot be removed in the group. When the user calls LeaveGroup, or when he/she is disconnected to the server, he/she becomes "offline", but he/she still a member of the group. Such user can be removed from the group only after joining to it again with Permanent = False. This feature allows using groups as contact lists.
LeaveGroup deletes this sender from the group. All members of this group receive notifications about this user exiting the group (OnUserLeavesGroup event of their receivers). If it was the last user of the group, the group is deleted on the server. If the connection between this client and the server is broken, the server itself informs the group members about this user exiting.
GetUsersFromGroup receives a list of users belonging to the group. If the parameter Online=True, it returns only group users which are currently connected. A list of users is returned in OnGetGroupUsers of the receiver.
GetAllGroups returns a list of groups on the server. This command is supported only if rvcpUseSystemCmd and rvcpCmdAllGroups are included in TRVMediaServer.CmdOptions. A list of groups is returned in OnGetAllGroups of the receiver.
GetGroupInfo returns information about the specific group (its name and creator). This information is returned in OnGetGroupInfo of the receiver.
•information about groups in the topic about TRVMediaServer