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

Cc59f0deef3e3d0598ca2ea8e5193dbd?s=128

Kaustav Das Modak

November 11, 2020
Tweet

Transcript

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

  2. In this presentation • Decentralization basics • What is Matrix?

    • Specification overview • Ecosystem overview • Building a simple Matrix client using Matrix JS SDK
  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
  4. We can decentralize enough HTTP. DNS. HTML. JSON. Web servers.

    APIs. Web Browsers… Matrix.
  5. About Open standard for interoperable, decentralized, real-time communication over IP.

    See: matrix.org
  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
  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
  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
  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
  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
  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
  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
  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.
  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. ☺
  15. fin. By: @kaustavdm | kaustavdm.in License: CC-BY 4.0