This is similar to Know when Facebook chats have been seen via API? but more or less the reverse.
I am using the fql "thread" object in combination with an XMPP chat to add some messaging/inbox functionality to a client side app. I notice if the user adds a message to a thread via XMPP, the "unseen" field in the fql "thread" is switched off. My question: Is there a way to send some form of message/element to chat.facebook.com that will switch the "unseen" field to off short of sending an actual message. Thanks!
I have tried;
<message type="chat" to="-fbid#chat.facebook.com">
<active xmlns="http://jabber.org/protocol/chatstates"></active>
</message>
Also tried to trick the service with;
<message type="chat" to="-fbid#chat.facebook.com">
<composing xmlns="http://jabber.org/protocol/chatstates"/>
</message>
Even tried to send a dummy message with empty body;
<message type="chat" to="-100004885119811#chat.facebook.com">
<body></body>
</message>
Related
I have a chat client that can be incorporated into multiple hosts, the chat client is independent.
User A logs in at two places - say chrome and firefox
So User A sends Message User B, User B receives the message, chat message is displayed at both sides.
Now User A has logged in at the window in the separate browser also, I want to push the message and display the message here also
Just like if you open a Gmail chat window at multiple browsers, then the sent message is pushed at both the ends.
XMPP protocol define JID as following:
JIDs consist of three main parts:
The node identifier (optional) The domain identifier (required) The
resource identifier (optional) JIDs are encoded UTF-8. A grammar will
be presented first, followed by specific clarifying and further
restricting remarks.
or in s simpler language you JID is built from:
Username#YourDomain.com/Resource
one user can have many resources,
for example:
prashantsahni#domain.com/phone
prashantsahni#domain.com/firefox
prashantsahni#domain.com/chrome
just set up the right resource for the user each time and let the XMPP Server to take care of the rest.
and you can look at this post to see how to do it with strophe
tou can read more about it in here:
https://xmpp.org/extensions/xep-0029.html
I am using message carbon.
There is a plugin provided by strophe. - strophe carbon
I have implemented using message carbons. The XEP is given here. For this to work you will need to check if the server supports this XEP. Most servers, Ejabberd, MongooseIM, Openfire, etc., supports the extension. The server will forward the message carbon to each resource. Once you have enabled message carbons in your server, all you need is to take care of the stanza which is being forwarded to you from each resource for a JID.
Lets say the JID for user A and user B is userA#domain.com and userB#domain.com, and you login to both chrome and firefox using the full JIDs below:
userA#domain.com/chrome
userA#domain.com/firefox
Now when you start sending message to user B from chrome, the message will be sent to your XMPP server which then also forwards the same message to your firefox browser. Lets say if the original message stanza sent from chrome is as follows:
<message xmlns='jabber:client'
from='userA#domain.com/chrome'
to='userB#domain.com'
type='chat'>
<body>What man art thou that, thus bescreen'd in night, so stumblest on my counsel?</body>
<thread>0e3141cd80894871a68e6fe6b1ec56fa</thread>
</message>
You should receive the forwarded stanza in your firefox as follows:
<message xmlns='jabber:client'
from='userA#domain.com'
to='userA#domain.com/firefox'
type='chat'>
<received xmlns='urn:xmpp:carbons:2'>
<forwarded xmlns='urn:xmpp:forward:0'>
<message xmlns='jabber:client'
from='userA#domain.com/chrome'
to='userB#domain.com'
type='chat'>
<body>What man art thou that, thus bescreen'd in night, so stumblest on my counsel?</body>
<thread>0e3141cd80894871a68e6fe6b1ec56fa</thread>
</message>
</forwarded>
</received>
</message>
You need to extract original message from the forwarded stanza. Also note that you can use each browser tab as a separate resource. You might also want to configure the maximum number of resources the server can handle at a time for a user.
I have an XMPP chat client using wokkel and twisted and it works fine, but when a user comes online, I send this stanza to get the messages a user received while offline:
<iq type='get' id='fetch1'><offline xmlns='http://jabber.org/protocol/offline'><fetch/></offline></iq>
Other messages send and receive just fine but this stanza never returns anything. Any ideas how to debug or what the issue is? (These are google talk users)
Update: Google talk in theory supports XEP-0136 (archiving). When you get a list of support features you get:
<feature var='http://jabber.org/protocol/archive#otr'/>
<feature var='http://jabber.org/protocol/archive#save'/>
However, when I then follow this: http://xmpp.org/extensions/xep-0136.html#manage-retrieve
as to how to retrieve archived messages. I send the following stanza:
<iq type='get' id='page1'><retrieve xmlns='urn:xmpp:archive'/></iq>
[Whether or not I include the tag part of their example, I get a feature not support error back from Google's XMPP server]
<iq xmlns='jabber:client' to='x#gmail.com/7EBA7137' type='error' id='page1'>
<retrieve xmlns='urn:xmpp:archive'/><error code='501' type='cancel'>
<feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>
FB authentication is proper and i can receive messages. Only issue is when sending messages to a FB friend. No error messages or warnings are being shown, but the message is simply not delivered to the FB friend.
This is the string that i am sending
<message xmlns="http://www.facebook.com/xmpp/messages" to="-FB_ID#chat.facebook.com">
<body>my_message</body></message>
Any one having same issue?.
The "from" parameter is missing in your requset. Message format should be like this:
<message from="-sender_ID#chat.facebook.com" to="-receiver_ID#chat.facebook.com">
<body>your_message</body>
</message>
Is this something to do with the 5000 friend limit ? I mean, you are not allowed to have more than 5000 friends on FB, therefore, I'm guessing there is a security issue that stops you posting once you hit that limit ?
Issue fixed.
Author replied me:
OK, I haven't done anything with Facebook chat but why are you setting the xmlns?
That exactly was my problem. I was sending the xmpp messages as shown below:
<message xmlns="http://www.facebook.com/xmpp/messages" to="-FB_ID#chat.facebook.com">
<body>dd</body></message>
When I removed the xmlns attribute, everything is fixed :)
I have being checking out using a prototype test program the capabilities of the XMPP Facebook Chat, X-FACEBOOK. It worked great using a geoloc message XEP 0080 with Gmail servers, but when i try to send the same XML structure through the X-FACEBOOK, it trims the message and removes the GeoLoc node.
I wanted to ask if someone knows if its possible to send XEP 0080 messages in X-FACEBOOK and if so what structure should I use so the Facebook Chat XMPP Server won't trim the GeoLoc info.
Sent XMPP geoloc message:
<message to="-100002578491827#chat.facebook.com" from="4yony4#chat.facebook.com/19256ca9_4C5CC12947646" type="chat" xml:lang="en">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<items node="http://jabber.org/protocol/geoloc">
<item id="">
<geoloc xmlns="http://jabber.org/protocol/geoloc">
<lat>40.488137</lat>
<lon>-3.397623</lon>
<timestamp>2012-07-27 09:09:50 GMT</timestamp>
<msgType>0</msgType>
</geoloc>
</item>
</items>
</event>
<body>
</body>
Received message by client:
<message xmlns="jabber:client" from="-1177157556#chat.facebook.com" to="" type="chat">
<active xmlns="http://jabber.org/protocol/chatstates"/>
<body></body>
</message>
Any solution or opinion will be greatly appreciated.
Well, changed the XML to resemble the one you posted, without the pub sub, and still the same problem, the message received in the recipient lacks all the namespaces under the GeoLoc node, which I think is a result of the Server not supporting that format. I can try and use the IQ subscriber option, thing is that I prefer to find a solution on which I can directly send the info to a user.
If there is a possibility, even a small one in which i may be able to send information regarding GeoLoc from User A to User B in Facebook Server it may be of great help, if not well i guess i will have to accept it.
Thx for the help BTW.
When I was testing facebook XMPP connection, it did not support almost any extensions and blocked any custom tags on server. It was able to send basic presences, basic messages, vcards and that was about all it could do.
Pubsub events should be sent to services. Modern XMPP servers also support PEP extension and you can send pubsub to servers itself. In other cases, use message with target user as Robin have advised.
I do not think facebook has any server with pubsub. Also i think it still filters any unsupported namespaces. Feel free to prove me I am wrong, it is more than year since I last tested it.
These are not the same message.
The received message is simply an indicator of the users chat state, as defined in XEP-0085 and has no direct relationship to the message you sent. That doesn't mean that the first didn't potentially trigger the second, whatever library you are using may have sent the chatstate as well when you sent the message. This type of message is commonly used in chat clients to indicate that someone you are chatting with is typing a message.
The problem is probably that the message you are sending is in fact a PEP message. This is meant to be sent by the PEP service in the server, not from a client. I don't know if Facebook supports PEP or not, but I would guess that it is being filtered out due to your incorrect usage of a known namespace. PEP or Pubsub are the recommended ways of publishing geolocation information, but to utilize those you have to send an IQ packet to the service, not a message to the other client.
Try this instead (Not saying it will work, but at least the pubsub stuff is stripped):
<message to="-100002578491827#chat.facebook.com" from="4yony4#chat.facebook.com/19256ca9_4C5CC12947646" type="chat" xml:lang="en">
<geoloc xmlns="http://jabber.org/protocol/geoloc">
<lat>40.488137</lat>
<lon>-3.397623</lon>
<timestamp>2012-07-27 09:09:50 GMT</timestamp>
<msgType>0</msgType>
</geoloc>
<body>
</body>
</message>
I want to second Pihhan. It seems like the Facebook XMPP servers restructure messages to contain only the message body, date, and timestamp. I think they do that to keep it identical to their comment graph objects.
It is annoying, but I suspect it is deliberate. After all, their Graph is the main issue, not XMPP.
Im using Jabber-Net API to make a GMail client. I've been having problems with the subscription process using my client as it always returning the "subscription=none" and "ask=none". When i subscribe a new user, it works fine but, subscribing/ unsubscribing users very frquently from roster makes the users stop to send subscription request with "to/ from/ both" or etc.
I have discovered that, "CONTACT" always receives a packet like this:
<iq type="set">
<query xmlns="jabber:iq:roster">
<item
jid="jabberuser#host"
subscription="none"
ask="none"/>
</query>
</iq>
Any prompt answer will be much appreciated..
Are you sending a presence subscription?
<presence type='subscribe' to='jabberuser#host'/>