Meshagent Rooms provide real-time collaborative workspaces for agents and participants. Each room dynamically manages participant lists, tracks presence, and enables information sharing. Rooms are automatically provisioned when participants join, ensuring effortless integration and minimizing synchronization complexity.

Rooms also serve as gateways to several additional APIs accessible through the room object:

  • Agents API AgentsClient: Manages agent interactions.
  • Database API DatabaseClient: Provides a simple relational-like API for data storage and retrieval through tables.
  • Queues API QueuesClient: Facilitates reliable data/message exchange with other agents or participants.
  • Messaging API MessagingClient: Enables real-time chat messaging among participants.
  • Sync API SyncClient: Offers document synchronization capabilities, listing remote participants, allowing participants to collaborate on shared documents.
  • Storage API StorageClient: Manages file storage and retrieval.

Key Functionalities

  • Ephemeral Design: Automatically provisioned when the first participant joins and deprovisioned when the last leaves, existing only during active collaboration.
  • No State Persistence: Logs session details in the admin console; the room state itself is discarded after the session ends.
  • Document Management: Provides temporary in-memory document synchronization and sharing. Document changes persist to external storage on modification or session end. Meshagent Cloud includes built-in storage, with custom external providers supported.

Let’s connect to a room

import asyncio
from meshagent.api import RoomClient, websocket_protocol

async def main():    
    # Define a unique room name
    room_name = 'my-room'
    participant_name = 'my-participant'

    async with RoomClient(
        protocol=websocket_protocol(
            participant_name=participant_name,
            room_name=room_name
        )) as room:   
            print("connected to room")

if __name__ == '__main__':
    loop = asyncio.new_event_loop()
    asyncio.set_event_loop(loop)
    asyncio.get_event_loop().run_until_complete(main())


Room Class Overview

Methods

  • start: Establishes a connection to the server.
  • dispose: Disconnects from the server and cleans up resources.
  • sendRequest: Sends requests to the server.
  • emit: Emits events to room listeners.
  • listen: Listens for room events.

Getters

  • localParticipant: Retrieves local participant details.

  • ready: Indicates room readiness.

  • sync: Accesses synchronization functionality (SyncClient).

  • storage: Accesses storage functionality (StorageClient).

  • agents: Accesses agents functionality (AgentsClient).

  • queues: Accesses queues functionality (QueuesClient).

  • messaging: Accesses messaging functionality (MessagingClient).

  • database: Accesses database functionality (DatabaseClient).