<!-- Add to your HTML --> <script src="web-agent.libs.js"></script> <script src="web-agent.js"></script> <!-- Optional: For WebRTC (video/audio/screen sharing) --> <script src="web-agent.webrtc.js"></script>
const agent = new AgentConnection(); agent.connect({ channelName: 'my-room', channelPassword: 'secret123', agentName: 'player-1', api: 'https://hmdevonline.com/messaging-platform/api/v1/messaging-service', apiKey: 'your-api-key' });
// Simple text message agent.sendTextMessage('Hello, World!'); // Object format (for advanced options) agent.sendMessage({ content: 'Hello, World!', type: 'chat-text', to: 'player-2' // Optional: specific agent }); // Receive messages agent.onMessage = (msg) => { console.log(msg.content); };