Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    matrixbot
    @matrixbot
    xurizaemon hey all, I have a Matrix JS SDK question I'll repost from #matrix-js-sdk:matrix.org but happy to discuss there if that's more appropriate :)

    xurizaemon hi there, new to matrix-js-sdk and trying to understand an issue i'm seeing. redirect me if this isn't the place for it.

    I can connect a bot (hubot + hubot-matrix-enhanced + matrix-js-sdk) to my server. Matrix is at matrix.bots.dev.example.org, Element is at bots.dev.example.org.

    This sample code connects and starts showing events after a sync: https://gist.github.com/xurizaemon/63fe0d6f64f645943f2a8aac0e4cf5c0

    When I connect via the bot adapter, it connects but throws a 404 on getFilter(), and it requests an odd filter URL with two server components in the user ID.

    POST /_matrix/client/r0/user/%40%40botname%3Abots.dev.example.org%3Amatrix.bots.dev.example.org/filter?access_token=blehblehbleh

    Since I'm new to Matrix and the SDK, IDK if the appended hostnames are a Matrix type of bangpath (series of hostnames for delivery, intended) or a bug in one of the three modules in play.

    Anyone care to help me understand what I should expect here? I don't think I'm looking at a "bangpath" situation, but I'm struggling to trace the source of the suffix in the client.

    xurizaemon I can work around the bug by rewriting the userId in the creds object here but I rather want to understand if this is an issue with the adapter usage / my config.
    matrixbot
    @matrixbot
    xurizaemon the issue repros on this server so I don't suspect server config / setup
    xurizaemon * I can work around the bug by rewriting the userId to remove additional :hostname in the creds object here but I rather want to understand if this is an issue with the adapter usage / my config.
    xurizaemon * I can work around the bug by rewriting the userId to remove additional :servername in the creds object here but I rather want to understand if this is an issue with the adapter usage / my config.

    xurizaemon * hi there, new to matrix-js-sdk and trying to understand an issue i'm seeing. redirect me if this isn't the place for it.

    I can connect a bot (hubot + hubot-matrix-enhanced + matrix-js-sdk) to my server. Matrix is at matrix.bots.dev.example.org, Element is at bots.dev.example.org.

    This sample code connects and starts showing events after a sync: https://gist.github.com/xurizaemon/63fe0d6f64f645943f2a8aac0e4cf5c0

    When I connect via the bot adapter, it connects but throws a 404 on getFilter(), and it requests an odd filter URL with two server components in the user ID.

    POST /_matrix/client/r0/user/%40%40botname%3Abots.dev.example.org%3Amatrix.bots.dev.example.org/filter?access_token=blehblehbleh

    Since I'm new to Matrix and the SDK, IDK if the appended hostnames are a Matrix type of bangpath (series of hostnames for delivery, intended) or a bug in one of the three modules in play.

    Anyone care to help me understand what I should expect here? I don't think I'm looking at a "bangpath" situation, but I'm struggling to trace the source of the suffix in the client.

    matrixbot
    @matrixbot
    @wontruefree:matrix.org is there a good guide to integrating matrix as a chat into an application
    matrixbot
    @matrixbot
    @cadence:cadence.moe what kind of application are you thinking of?
    matrixbot
    @matrixbot

    @nik:matrix.teckids.org What would be the most appropriate mechanism for such an application:

    I want to transfer a short-lived state (e.g. my current geolocation) into a room. Once all participants got the state, it becomes obsolete, or if I set the state to a new value, the older updates become irrelevant as well. Everyone only needs the msot recent state.

    I know there are room states, but they are per room, not per user. I tried using a simple message with a custom tpe, which works, but unnecessarily bloats the room.

    matrixbot
    @matrixbot

    @kb1rd:kb1rd.net > <@nik:matrix.teckids.org> What would be the most appropriate mechanism for such an application:

    I want to transfer a short-lived state (e.g. my current geolocation) into a room. Once all participants got the state, it becomes obsolete, or if I set the state to a new value, the older updates become irrelevant as well. Everyone only needs the msot recent state.

    I know there are room states, but they are per room, not per user. I tried using a simple message with a custom tpe, which works, but unnecessarily bloats the room.

    I think you want matrix-org/matrix-doc#1769 and you can put the state/events in the profile room

    @nik:matrix.teckids.org > <@kb1rd:kb1rd.net> I think you want matrix-org/matrix-doc#1769 and you can put the state/events in the profile room

    Uh. So that's one extra room per user, as I read it

    @kb1rd:kb1rd.net Yes
    matrixbot
    @matrixbot
    @cadence:cadence.moe You could also just create and use a real room for each user.
    @cadence:cadence.moe If this is part of the application then you could automate creating the room.
    @cadence:cadence.moe Or, if all the users should know about each other, then you could use a single room that you join all users to, and use state events with the state key being the user's mxid.
    @cadence:cadence.moe Maybe.
    @nik:matrix.teckids.org Ooooh, coding the user ID into the state key is so simple I really didn't think about it!
    @x:riot.ovh the additional nicety of that is that in Matrix an MXID state_key can only be modified by that user
    @cadence:cadence.moe oh, really?
    matrixbot
    @matrixbot
    @cadence:cadence.moe so that restriction automatically applies to any state keys that look like they fit the pattern of a user id?
    @x:riot.ovh > With the exception of a few events, state events set with a given user's ID as the state key MUST only be set by that user.
    @nik:matrix.teckids.org But that is only for states with exactly the user id as state key, right?
    @cadence:cadence.moe Oh I see. Starting with an @.
    @nik:matrix.teckids.org But then, a state can contain any JSON object, so I can sub-namespace it, right?
    @x:riot.ovh how would that make sense in any other way though?

    @cadence:cadence.moe > <@nik:matrix.teckids.org> But that is only for states with exactly the user id as state key, right?

    Yeah, though you can put a bunch of stuff in a single state event.

    @x:riot.ovh Yes you could split up the content of the state event as you wish
    @nik:matrix.teckids.org But if I had two applications using this method in the same room, I would have to take care that they re-create the state of the others into their state event?
    @cadence:cadence.moe Or you could use multiple event types to make up the thing, e.g. com.me.gps.lat and com.me.gps.lon.
    @nik:matrix.teckids.org Ah they are keyed by name and type together?
    @cadence:cadence.moe Yeah, type + state key is the unique id for states.
    @cadence:cadence.moe Goodnight
    matrixbot
    @matrixbot
    @nik:matrix.teckids.org Very cool, I think that compeltely solves my problem
    @nik:matrix.teckids.org Thanks a lot cadence [they] Michael (t3chguy) KB1RD
    matrixbot
    @matrixbot
    @nik:matrix.teckids.org Can I get the room states without syncing the full room history?
    matrixbot
    @matrixbot

    @nik:matrix.teckids.org > <@x:riot.ovh> Natureshadow: https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-rooms-roomid-state

    Yep I know, but does it require a sync loop?

    @nik:matrix.teckids.org (I am pretty sure the question is stupid :))
    matrixbot
    @matrixbot
    @x:riot.ovh No
    @x:riot.ovh it takes no sync token
    @nik:matrix.teckids.org But I would also get state change events in a sync loop, so I do not have to poll?
    @x:riot.ovh Yup
    matrixbot
    @matrixbot
    @nik:matrix.teckids.org Can I somehow control who can update a state with a specific type and name? I.e. can I put a state event, and tell teh server that everyone in the room may also update it as they please?
    matrixbot
    @matrixbot
    @x:riot.ovh only by event type
    matrixbot
    @matrixbot
    @nik:matrix.teckids.org Well that's sufficient. And I guess I send an m.room.power_levels event to set it?
    @x:riot.ovh Yup
    matrixbot
    @matrixbot

    @nik:matrix.teckids.org So, back to the filte rissue I already had a few weeks ago… concerning the above:

    I want to write a sync filter that will catch exactly one state event type in exactly one room. I tried several things, but I keep receiving all sorts of other events no matte rwhat I try.

    Using this filter for example, I also get a guest_access event by my own user (which I excluded):

    {
                    "room": {
                        "state": {
                            "types": ["com.example.my_state_type"],
                            "rooms": ["!0123456789abcdef:example.com"],
                            "not_senders": ["@myuser:example.com"],
                        }
                    }
                }
    @nik:matrix.teckids.org I only want this exact type of event, in exactly this one room, and if not set by myself