Package org.atmosphere.room
Interface VirtualRoomMember
public interface VirtualRoomMember
A non-connection-based room participant — for example, an AI agent, bot,
or server-side service that can receive room messages and respond.
Unlike AtmosphereResource, a virtual member
has no underlying WebSocket or HTTP connection. It participates in the room
purely through the onMessage(org.atmosphere.room.Room, java.lang.String, java.lang.Object) callback.
room.joinVirtual(new LlmRoomMember("assistant", model, settings));
room.broadcast("What is the weather?");
// The LLM virtual member receives the message and streams a response
// back to all human members via room.broadcast()
- Since:
- 4.0
- See Also:
-
Method Details
-
id
String id()Stable identifier for this virtual member (e.g., "assistant", "bot-1"). -
onMessage
Called when a message is broadcast in the room. The virtual member can respond by broadcasting back into the room.Implementations should be thread-safe — this method may be called from multiple threads concurrently.
- Parameters:
room- the room where the message was broadcastsenderId- UUID of the sender (resource UUID or virtual member id)message- the broadcast message
-
metadata
Optional metadata for presence events (e.g., display name, avatar).- Returns:
- metadata map, never null
-