Skip to content

makeEvent api #8

Description

@wouter173

makEvent

Design

The mxfx/client is a higher level abstraction over the matrix client-to-server api. It contains a heavy weight local mirror of room content for usage in complex web/native matrix clients. The challenge with having a heavy-weight message store, is to implement higher level spec compliant functionality like redactions while still allowing for flexibility of custom events.

The receiving end of the API design is based around (for now matrix only) events, this is what developers will be able to subscribe to as the main way of interacting with sync.

const messageEvent = makeEvent({
  predicate: () => {/*....*/}, 
  type: "m.room.message", 
  bucket: "rooms.joined", 
  schema: Schema.Struct({/*....*/})
})

yield* client.onEvent(messageEvent, (event) => Effect.log(event))

With this api it is possible to provide a lot of default events in the library (at least all m. namespaced events) while allowing for easy extension for custom events.

Open issues (related)

Abstraction over onEvent predicates. onEvent currently is named wrong, it currently functions as an api called onSync would.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions