Comments (23)
@prefiks, @badlop Please help.!
from ejabberd.
So in other words you created room with create_room_with_opts
with subscribers and then when you sent message to a room using command (what exactly command?), that didn't get delivered to subscriber from create command, yes? I am just trying to see what i need to do to reproduce it.
from ejabberd.
yup, @prefiks i used two ways:
- I use admin api https://docs.ejabberd.im/developer/ejabberd-api/admin-api/#send-message
- I use XMPP send stanza
<message to='[email protected]' type='groupchat' id='e23ff0a35b4e9150' xml:lang='en'><body>testing </body></message>
from ejabberd.
It's working in my tests, you are aware that mucsub will not send regular groupchat message, but event with wrapped message like this:
<message to='prefiks@localhost' from='[email protected]' id='1713861977424826' xmlns='jabber:client'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<items node='urn:xmpp:mucsub:nodes:messages'>
<item id='1713861977424826'>
<message to='prefiks@localhost' from='[email protected]/p2' type='groupchat' id='10483677060557293314' xmlns='jabber:client'><body>test</body>
</message>
</item>
</items>
</event>
</message>
from ejabberd.
hi @prefiks, i call Admin Api send-stanza https://docs.ejabberd.im/developer/ejabberd-api/admin-api/#send-stanza
<message to='7214252@localhost' from='[email protected]' id='1713865884466642' xmlns='jabber:client'><event xmlns='http://jabber.org/protocol/pubsub#event'><items node='urn:xmpp:mucsub:nodes:messages'><item id='1713865884466642'><message to='7214252@localhost' from='[email protected]/7238854' type='groupchat' id='1713865884466642' xmlns='jabber:client'><body>test</body></message></item></items></event></message>
but it did not work. I can't receive the message at SSE connection. Data has stored at db.
from ejabberd.
So that message that i showed in previous message was a result of calling
ejabberdctl send_message groupchat user@localhost [email protected] "" test
and that resulted in sending that event to subscribers in a room.
I think your ejabberd sends event like this too, but your SSE server doesn't recognize it. Are you able to see all traffic that your code receive?
from ejabberd.
hi @prefiks, i can see the traffic come ejabberd server. I think SSE server doesn't recognize it because it's not auto join when a new group created. When i reconnect SSE and join all group that user subscribe then message receive.
ejabberdctl send_message groupchat 7238854@localhost [email protected] "" TestBody
from ejabberd.
Hi @prefiks,
Even if I reuse the xmpp client id in the call flow through the Chat APIs Server to join the room i created.
I also did not receive the message when I sent it.
send_message groupchat 7238854@localhost [email protected] "" TestBody
From admin website no any users join the room
from ejabberd.
So about send_message not sending message to a room, user that you use in 'from' must be room subscriber or muc admin, only those two classes can send message without joining room first.
from ejabberd.
hi @prefiks, Are these users who subscribe to the room?
When i created the room. all users are become subscriber.
from ejabberd.
Yes that list of room subscribers.
from ejabberd.
yeah, and i using 7238854@localhost 7238854 is a room subscriber to sending message to the room. But all other subscribers don't receive messages.
If i'm not join the room, i'm not receive the history message. I don't know if I did something wrong? Please help.
from ejabberd.
I don't know, do you have anything logged by server when you call that?
from ejabberd.
yes, when i call send_message
send_message groupchat 7238854@localhost [email protected] "" "TestBody no join group"
from ejabberd.
So it seems that part is working.
from ejabberd.
ok @prefiks, let's me check again. But. i can't receive history message if i don't join group. in case user disconnected, the SSE connection lost. Currently, when user reconnect SSE, i join all group user subscribe.
from ejabberd.
Messages with event are stored in both user archive and offline storage (so they will be redelivered when user comes online). So those are two ways you can get older mesages.
from ejabberd.
in case user login on the other devices. I will get the messages history from api?
from ejabberd.
Hi @prefiks, I received data from ejabberd with type xmpp.PubsubEvent, parsing xml and received the message.
{
"Node": "urn:xmpp:mucsub:nodes:messages",
"Items": [
{
"ID": "1713956108027223",
"InnerXML": "PG1lc3NhZ2UgdG89JzcyMTQyNTJAbG9jYWxob3N0JyBmcm9tPSdyb29tMUBjb25mZXJlbmNlLmxvY2FsaG9zdC83MjM4ODU0JyB0eXBlPSdncm91cGNoYXQnIGlkPScxMjE4OTA1NjA4NjQ4ODIyMTgzMicgeG1sbnM9J2phYmJlcjpjbGllbnQnPjxhcmNoaXZlZCBieT0ncm9vbTFAY29uZmVyZW5jZS5sb2NhbGhvc3QnIGlkPScxNzEzOTU2MTA4MDI3MjIzJyB4bWxucz0ndXJuOnhtcHA6bWFtOnRtcCcvPjxzdGFuemEtaWQgYnk9J3Jvb20xQGNvbmZlcmVuY2UubG9jYWxob3N0JyBpZD0nMTcxMzk1NjEwODAyNzIyMycgeG1sbnM9J3Vybjp4bXBwOnNpZDowJy8+PGJvZHk+aGFoYWhhaGEgPzwvYm9keT48L21lc3NhZ2U+"
}
]
}
InnerXML after parse
<message to='7214252@localhost' from='[email protected]/7238854' type='groupchat' id='12189056086488221832' xmlns='jabber:client'><archived by='[email protected]' id='1713956108027223' xmlns='urn:xmpp:mam:tmp'/><stanza-id by='[email protected]' id='1713956108027223' xmlns='urn:xmpp:sid:0'/><body>hahahaha ?</body></message>
So what is the difference between muc and mucsub?
- Mucsub, I can get the subscriber list to display, right?
- For both modules, do I have to call the api to get message history when the user logs in on another device?
Please help me understand them clearly.!
from ejabberd.
Regular muc: you must be online, and explicitly join room to receive messages, when you go offline, you automatically leave room and messages stop arrive.
Mucsub: after subscribing room you will get event for every message until you unsubscribe from room. Messages will also arrive when you are offline, so with mod_offline enabled, they will be delivered to you after you reconnect.
from ejabberd.
Yeah, I understand clearly.!
Thanks so much @prefiks. You save my day.! :D
from ejabberd.
Messages with event are stored in both user archive and offline storage (so they will be redelivered when user comes online). So those are two ways you can get older mesages.
Hi @prefiks, with MUCSUB when user online. If user don't join the room, will the message be automatically deliver? What is the best practice for returning history messages to users?
from ejabberd.
How to know if a subscriber is online in a room @prefiks ?
from ejabberd.
Related Issues (20)
- Assigning INET_DIST_INTERFACE to an IPv6 address HOT 3
- exception error: {unregistered_route,<<"pubsub.domain.tld">>} HOT 4
- Dependency conflicts when using Timex with Ejabberd HOT 2
- Update mod_muc_room to support XEP-0425 0.3.0 (VERY EARLY DRAFT)
- erts_vsn inside ejabberdctl never gets set HOT 3
- SASL2: Stable resource is used if no user-agent id is set. HOT 8
- Error While call /api/get_user_subscriptions at localhost HOT 3
- Return type of get_vcard API call changed (and is different from docs) HOT 2
- ejabberd do not start after update from 23.10 to 24.02 HOT 5
- Store data into nick column on archive table.
- Date and reason for banned accounts not stored when using SCRAM HOT 6
- How to get the current date for created_at when create a Multi-User Chat. HOT 19
- Stream closed by local host: has been kicked (policy-violation) HOT 2
- [Question] Custom Module deps HOT 8
- mod_block_strangers: Allow messages from joined MIX channels HOT 1
- "Internal error of module mod_mam has occurred during start" related to origin_id HOT 9
- Error after disabling and enabling back mod_fail2ban HOT 1
- Rebar3 downloads all dependencies in rebar.lock, even the disabled ones
- jose_server.erl - syntax error before: 'catch', function handle_call/3 undefined HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ejabberd.