Social & Economy
aether-social
Social graph, friends, groups, presence, and chat
The aether-social crate provides social features for Aether, including a friend system, blocking, group management, presence tracking, real-time chat, and horizontal sharding for scalability.
Overview
Social interactions are central to a VR platform. This crate handles:
- Friend management with request, accept, reject, and remove workflows.
- Block lists that suppress visibility, chat, and interaction between users.
- Groups for persistent social circles with invitations and member roles.
- Presence tracking that shows where friends are and what they are doing.
- Real-time chat with channels for proximity, group, and direct messages.
- Horizontal sharding that distributes the social graph across database shards.
Key Types
SocialService
The top-level facade that provides access to all social subsystems.
use aether_social::{SocialService, SocialResult};
let service = SocialService::new(db_pool);
FriendManager
Manages the friend relationship lifecycle.
use aether_social::{FriendManager, FriendRequest, FriendStatus};
let mut friends = FriendManager::new();
friends.send_request(user_a, user_b)?;
friends.accept_request(user_b, user_a)?;
let status = friends.status(user_a, user_b);
assert_eq!(status, FriendStatus::Friends);
BlockList
Maintains per-user block lists that affect visibility and communication.
use aether_social::BlockList;
let mut blocks = BlockList::new(user_id);
blocks.block(other_user);
assert!(blocks.is_blocked(other_user));
GroupManager
Handles persistent groups with invitations, membership, and configuration.
use aether_social::{GroupManager, GroupConfig, GroupStatus};
let mut groups = GroupManager::new();
let group_id = groups.create(GroupConfig {
name: "Explorers Guild".into(),
max_members: 50,
})?;
groups.invite(group_id, invitee_id)?;
PresenceTracker
Tracks player online status and current location in the world network.
use aether_social::{PresenceTracker, PresenceState, PresenceKind, InWorldLocation};
let mut presence = PresenceTracker::new();
presence.update(user_id, PresenceState {
kind: PresenceKind::Online,
location: Some(InWorldLocation {
world_id: "plaza".into(),
zone: "main".into(),
}),
visibility: PresenceVisibility::FriendsOnly,
});
ChatManager
Manages real-time chat channels with message routing.
use aether_social::{ChatManager, ChatMessage, ChatType, MessageKind};
let mut chat = ChatManager::new();
chat.send(ChatMessage {
sender: user_id,
channel: ChatType::Proximity,
kind: MessageKind::Text,
content: "Hello everyone!".into(),
})?;
Usage Examples
Friend Workflow
use aether_social::{FriendManager, FriendSummary, FriendState};
let mut friends = FriendManager::new();
// Send and accept a friend request
friends.send_request(alice, bob)?;
friends.accept_request(bob, alice)?;
// List friends
let alice_friends: Vec<FriendSummary> = friends.list(alice);
assert_eq!(alice_friends.len(), 1);
Sharding Policy
use aether_social::ShardMapPolicy;
let policy = ShardMapPolicy::new(num_shards);
let shard = policy.shard_for(user_id);