I am using Paho MQTT library, but I do not know how to know if i am currently subscribed to a certain topic so that, no to subscribe to it again.
is there any way to know if a specific topic i am subscribed to it or not??
No, you have to explicitly keep track of what you subscribed to yourself.
Related
I have an application using MQTT, with clients connected on various topics, however, I have the need to send a message only to a client, not to an entire topic. Is that possible?
No, MQTT is a pub/sub protocol, messages are published on topics and there may be 0 to many subscribers to that topic
The closest you can do is pick a topic that you know only the client you want will be subscribed to.
I'm currently upgrading my implementation that uses Twilio IPM to use the new GA release twilio-chat after previously using the twilio-ip-messaging package on npm. There are some disparities between the implementations, but this hasn't really been that much of an issue so far. However it seems that there are some event behaviours that have changed and I struggle to understand why.
Prior to twilio-chat, if I had a client A connected in a browser context, any public channel creation (from another client B, or the server side) would trigger the channelAdded event from twilio. This no longer seems to happen. The new channel is visible on any subsequent getPublicChannelDescriptors call, but I do not receive the event.
Is it possible to opt-in to these events? Or in some other way configure that this should be announced to all connected clients?
I can think of a few workarounds, like a named persistent channel where new channel creation is announced, or some other 'push' mechanism for client A to then refresh its channels list, but all feels a bit dirty when there is already a push mechanism in place that used to effect the same behaviour.
Twilio developer evangelist here.
The channelAdded event for public channels was removed in the Programmable Chat SDKs because of a limitations of how many endpoints can subscribe to a single, global public channels object.
You can receive these events by webhook but you would still need a way to notify the client side of your application. Your suggestion of a persistent channel for this is a good workaround. You could even keep this channel hidden from view and send structured data in the message that would allow you to show the new channel in your interface and request more data about it via the SDK.
If a whole chat channel is too much of a hack, you could also try using Twilio Sync to synchronise a list of active channels between users.
I agree that this does seem like a bit of a hack though. It is possible that all channels will cause the channelAdded event again in the future, but I can't promise anything like that right now, so you will need to workaround it.
My question is related to pub and sub communication model. Specifically, can I send a request via this system. for example, If I'm the publisher, can I send a request to the subscribers saying I need more information about your system or some information about a specific thing. what i know that I can only publish data, but I do not know if I can send a request.
Yes, you can, the question is how correct is the use of the protocol for that..
Your client can pub a topic home/xoce/readyToGetInfo/ true and maybe all other clients subscribed to that topic can readdct to that and begin to push
home/xoce/temperature/ 11.11
but it looks very weird...
I am developing an App and I am using MQTT protocol supported by Paho library.
I am subscribing to 10 topics, and there will be a messgae(s) published for one at least one topic. now, when I get notified about the arrival of a new messae, how can i know to which topic it belongs?
Update:
The object that you get when the message arrives should have a destination field which will contain the topic.
I want to create a new plugin which will send live scores to the xmpp iOS client.
I have already created a new plugin and a service for it, but not getting any idea how to send live scores from openfire server to the xmpp iOS client.
Pls, suggest me something.
Thanks
One way would be to use multi chat. You can create a room for each match. Anyone who wishes to receive live score (or anything for that matter) joins the room. You have a bot that sends the score into the room and everybody who is in the room gets it. You can also configure the room so that it is visitors only and anonymous. See XEP-0045
Another way is the use pubsub. Again every match is a node. Users subscribe to the node. See XEP-0060
I'm not sure about others XMPP servers but IFAIK MUC and pubsub are supported by openfire.