Rocket.chat: RealTime API stream-notify-user/message event

Created on 26 Mar 2019  路  16Comments  路  Source: RocketChat/Rocket.Chat

Hello,

we are connecting to the RealTime API to recive Updates for a certain User.
But we haven't had a successfull trigger of the Message Event.
All other Events are Working (room-changed/subscription-changed).

When will the stream-notify-user/message event be triggered?

Bye skyJG

Most helpful comment

Seems like I found it. The collection name is stream-room-messages, and event name is __my_messages__. As such, the whole subscription message looks like that

{
  "msg": "sub",
  "id": "unique-id",
  "name": "stream-room-messages",
  "params": [
    "__my_messages__",
    false
  ]
}

All 16 comments

I made a test in the ARC client.
I can successfully Register the Event:.
github rchat message notify user

But I can't get it to fire.
Maybe it's the same as #12202

The notification Event works fine:
github rchat message notify user vs notification

Hello,

i have the same problem like you... I want to subscribe for each user his joined channels/private/ims.

I created a websocket for "stream-notify-user" with following events:

  • message
  • notification
  • rooms-changed
  • subscriptions-changed

When I send an message in one of my channels, i never get an event information in message event.
Is there any example how it works or is this buggy?

Thank you.

Bye Andreas H.

@skyJG @AndreasHo Yeah I still have the same problem here.

We did a Debug of the Rocket.Chat iOS App, but unfortunatley - no luck there...
We can't get it to fire there either.
rChat iOS Debug
rocket.chat.websocket-log.txt

Is the notify just on mention? I don鈥檛 think it鈥檚 for a general message stream

actually stream-notify-user/message is for ephemeral messages only..

for regular messages the correct stream is stream-room-messages/[ROOM_ID]

ok that makes sense. If this 馃敐 doesn't answer your question feel free to respond here.

Closing

@geekgonecrazy does that mean I have to subscribe to every single room to get new messages? Is there no subscription which would notify me about any message which my user has received, no matter if it's a group or direct channel? What happens if someone creates a room with me and is able to send a message faster than I subscribe?...

Seems like I found it. The collection name is stream-room-messages, and event name is __my_messages__. As such, the whole subscription message looks like that

{
  "msg": "sub",
  "id": "unique-id",
  "name": "stream-room-messages",
  "params": [
    "__my_messages__",
    false
  ]
}

But how do I now understand that the message was created, not edited, reacted to and so on but created? I get an update every time something about the message changes. But I only want to act if the message was created.

glad you found it @1valdis =) but unfortunately we'll always send an "update".. that's how we manage to hack meteor's subscriptions system to skip its merge box and thus be lighter on the server.

@sampaiodiego so, the only way to tell that a message is new and not updated is by comparing ts and _updatedAt with some offset (say 50-100 ms)? That is the only way I could find for now, although it's really hacky and somewhat unreliable :(

something like that.. you can also check if the editedBy field is there, which means the message was edited..

@sampaiodiego AFAIK it's there when the actual text of the message was edited. It isn't present when someone reacts or answers to it...

right, it is something extra you can check to validate it is a new message or not.

question also is there any reply message functions? do it make use of stream also?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Buzzele picture Buzzele  路  3Comments

tanc picture tanc  路  3Comments

neha1deshmukh picture neha1deshmukh  路  3Comments

marceloschmidt picture marceloschmidt  路  3Comments

mattlin picture mattlin  路  3Comments