Uniform Chat
  • Uniform.Matrix
  • API
Search Results for

    Show / Hide Table of Contents
    • Uniform.Matrix.Protocol.Core
      • Introduction
    • Uniform.Matrix.Protocol.Client
      • Introduction
      • Log in
      • Receive events
      • Rooms and messages
      • Directories and account data
      • Files and devices
      • Errors
    • Uniform.Matrix.Protocol.Crypto
      • Introduction
    • Uniform.Matrix.Hosting
      • Introduction
    • Uniform.Matrix.Gui.Terminal
      • Introduction
    • Uniform.Matrix.Audio
      • Introduction
    • Uniform.Matrix.Video
      • Introduction
    • Uniform.Stun.Protocol
      • Introduction
    • Uniform.Stun
      • Introduction
    • Uniform.LiveKit.Protocol
      • Introduction
    • Uniform.LiveKit
      • Introduction
    • Uniform.Matrix.WebRtc
      • Introduction
    • Uniform.Matrix.Client
      • Introduction
      • Room state
      • Rich text
      • Local storage
      • Outbox
      • Track rooms
    • Uniform.Matrix.Calls
      • Introduction
    • Uniform.Chat.Terminal
      • Introduction
    • Uniform.Chat.Avalonia
      • Introduction
      • View models
      • Views
    • Uniform.Chat.Desktop
      • Introduction
    • Uniform.Chat.Android
      • Introduction
    • Uniform.Matrix.Protocol.Server
      • Introduction
    • Uniform.Matrix.Server
      • Introduction
      • Requests
      • Storage
      • Events and state
      • Sync and the stream
      • Services
      • Push rules and pushers
      • Presence
      • URL previews
      • Rate limits
      • Federation
      • Testing
    • Uniform.Chat.Server
      • Introduction
    • Uniform.Turn
      • Introduction
    • Uniform.Stun.Hosting
      • Introduction
    • Uniform.Stun.Server
      • Introduction
    • Uniform.LiveKit.Authorization
      • Introduction
    • Uniform.LiveKit.Hosting
      • Introduction
    • Uniform.LiveKit.Server
      • Introduction
    • Building
    • Testing
    • Documentation

    Rooms and messages

    string roomId = await client.JoinRoomAsync("#general:matrix.org");
    
    await client.SendTextAsync(roomId, "hello");
    await client.SendEmoteAsync(roomId, "waves");                // * alice waves
    await client.SetRoomTopicAsync(roomId, "Friendly chat");
    
    MessagesResponse page = await client.GetMessagesAsync(roomId, limit: 50);   // newest first
    await client.SetReadMarkersAsync(roomId, page.Chunk[0].EventId, page.Chunk[0].EventId);
    
    await client.LeaveRoomAsync(roomId);
    

    Rich messages:

    await client.SendReplyAsync(roomId, originalEvent, "agreed");      // mentions the original sender
    await client.SendEditAsync(roomId, myEventId, "fixed typo");
    await client.SendReactionAsync(roomId, eventId, "👍");
    await client.SendHtmlAsync(roomId, "hi Bob", "hi <b>Bob</b>", new Mentions { UserIds = ["@bob:matrix.org"] });
    

    Sends get a fresh transaction ID each time. To retry a send safely after a network error, pass the same transactionId again; the server then returns the original event instead of sending a duplicate.

    • Edit this page
    In this article
    Back to top Uniform Chat