Upgrade to Pro — share decks privately, control downloads, hide ads and more …

About Matrix

About Matrix

A quick introduction to Matrix.org, along with writing a simple bot that says "hi".

Code: https://github.com/kaustavdm/matrix-js-sdk-howto

Kaustav Das Modak

November 11, 2020
Tweet

More Decks by Kaustav Das Modak

Other Decks in Technology

Transcript

  1. #about:matrix.org
    An HTTP nerd’s quick-view of the Matrix ecosystem

    View full-size slide

  2. In this presentation
    • Decentralization basics
    • What is Matrix?
    • Specification overview
    • Ecosystem overview
    • Building a simple Matrix client using Matrix JS SDK

    View full-size slide

  3. Decentralized



    Creating a system with no centralized control.
    Resilient: Survive failures
    Privacy-aware: Harder to snoop on user data
    Secure: E2E/distributed encryption & access control

    View full-size slide

  4. We can decentralize enough
    HTTP. DNS. HTML. JSON. Web servers. APIs. Web Browsers… Matrix.



    View full-size slide

  5. About
    Open standard for interoperable, decentralized, real-time
    communication over IP.
    See: matrix.org

    View full-size slide

  6. • Instant Message
    • VoIP/WebRTC signaling
    • IoT messaging
    • Bridging networks
    • Conversational bots
    • …
    “Anywhere you need a standard HTTP
    API for publishing and subscribing to
    data whilst tracking the conversation
    history.”
    - Matrix FAQ
    Use case scenarios

    View full-size slide

  7. Key features*
    JSON over HTTP APIs.
    • Fully distributed “rooms”
    • Inbuilt WebRTC calling
    • Clients can choose to store data
    locally, or, not
    * That I like.
    matrix.org
    Element.io
    Our bot
    IRC gateway
    example.org

    View full-size slide

  8. IDs & namespaces
    Username: @kaustavdm:matrix.org
    Room alias: #matrix-dev:matrix.org
    Room internal ID: !jxlRxnrZCsjpjDubDX:matrix.org
    Event namespace:
    • m.text
    • m.room.create
    • com.example.custom_event

    View full-size slide

  9. Matrix ecosystem
    Open standard – The Specification
    Client-Server API Federation API
    Application Service
    API
    Identity Service API
    Push Gateway API
    Implementation & ecosystem
    Element.io Gitter
    Application services Client SDKs
    Homeservers

    View full-size slide

  10. Let’s focus on
    Open standard – The Specification
    Client-Server API Federation API
    Application Service
    API
    Identity Service API
    Push Gateway API
    Implementation & ecosystem
    Element.io Gitter
    Application services Client SDKs
    Homeservers

    View full-size slide

  11. Client-Server API [Key features]
    Authentication
    • Login
    • Register
    • Account
    management
    Events
    • Syncing
    • Room Events
    • Receive
    • Send
    Room
    • Listing
    • Membership
    • Permissions
    User Data
    • Directory
    • Profile
    Modules
    • Instant
    Messaging
    • Direct
    Messaging
    • Presence
    • VoIP
    See: https://matrix.org/docs/spec/client_server/r0.6.1

    View full-size slide

  12. • Wrapper around HTTP API
    • Ergonomic & idiomatic JS code
    • Works in Node (LTS) & Browser
    ▪ Syncing
    ▪ Send & receive events
    ▪ Room state
    ▪ Retrying failed messages
    ▪ Queueing and pagination
    ▪ WebRTC calling

    Matrix JavaScript SDK

    View full-size slide

  13. Using Matrix JS SDK [happy path]
    What we want: Connect to Matrix as an existing user, using password
    login, send a message, and then quit.
    How we want it: As a Node.js script.
    When: Yesterday.

    View full-size slide

  14. Next steps
    • Read the Matrix specifications: matrix.org/docs/spec/
    • Look at the Matrix JS SDK: github.com/matrix-org/matrix-js-sdk/
    • Sample code I used: github.com/kaustavdm/matrix-js-sdk-howto/
    • Try out Element.io.
    • Build something nice. ☺

    View full-size slide

  15. fin.
    By: @kaustavdm | kaustavdm.in
    License: CC-BY 4.0

    View full-size slide