1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00
Files
matrix-js-sdk/examples/node
Johannes Marbach c8403f39aa Fix build failure in node.js example (#4394)
* Fix node.js example

Relates to: element-hq/element-web#26922
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>

* Update examples/node/app.js

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>

* Update examples/node/package.json

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>

* Move imports to the top of the file

---------

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2024-09-13 15:35:45 +00:00
..
2022-12-09 09:38:20 +01:00

This is a functional terminal app which allows you to see the room list for a user, join rooms, send messages and view room membership lists.

To try it out, you will need to edit app.js to configure it for your homeserver, access_token and user_id. Then run:

 $ npm install
 $ node app

Example output:

Room List:
[0] Room Invite (0 members)
[1] Room Invite (0 members)
[2] My New Room (2 members)
[3] @megan:localhost (1 members)
[4] True Stuff (7 members)
Global commands:
  '/help' : Show this help.
Room list index commands:
  '/enter <index>' Enter a room, e.g. '/enter 5'
Room commands:
  '/exit' Return to the room list index.
  '/members' Show the room member list.

$ /enter 2

[2015-06-12 15:14:54] Megan2 <<< herro
[2015-06-12 15:22:58] Me >>> hey
[2015-06-12 15:23:00] Me >>> whats up?
[2015-06-12 15:25:40] Megan2 <<< not a lot
[2015-06-12 15:25:47] Megan2 --- [State: m.room.topic updated to: {"topic":"xXx_topic_goes_here_xXx"}]
[2015-06-12 15:25:55] Megan2 --- [State: m.room.name updated to: {"name":"My Newer Room"}]

$ /members

Membership list for room "My Newer Room"
----------------------------------------
join      :: @example:localhost (Me)
leave     :: @fred:localhost (@fred:localhost)
invite    :: @earl:localhost (@earl:localhost)
join      :: Megan2 (@megan:localhost)
invite    :: @toejam:localhost (@toejam:localhost)