Open madsmtm opened 6 years ago
Hello,
It looks like the NodeJS implementation does not have much more information than we have (https://github.com/Schmavery/facebook-chat-api/blob/master/DOCS.md#listen)
I tried to understand the values of c, s or vc but nothing obvious. s looks always 'push', c is not always defined, vc is often 74. Maybe we can get information about those values in Facebook js, but it's not easy.
Do you received those messages without opening your browser? Even if markAlive is True I need to open my browser to receive buddylist_overlay messages, you too?
I can't confirm whether or not I can recieve these messages without opening Facebook in my browser, yet. If it's the case, though, then that's really wierd...
EDIT: I'm starting to think you're right about it...
Warning: There's a lot of complicated code here, if you don't understand boolean operators.
Anyways, I did some digging into the code on https://www.facebook.com
, it seems like c
and s
is unused, and I found that vc
gets saved, and can later be retrieved per user, with a function they called c('PresenceStatus').getCapabilities
. It's only used one place, a function they called c('FBRTCAvailability').isCallable
:
function(j) { // j is the user ID here
var k = c("PresenceStatus").getCapabilities(j); // Gets the `vc` value of the user
l = c("ChannelConstants").CAPABILITY_VOIP_INTEROP; // this is 8
return !!(k & l);
}
Basically, what I found is that if vc
is used as some sort of C-style boolean flag-holder-variable:
If vc & 8
, then Facebook say's the person is callable
I've currently only seen vc
be 0
, 8
, 10
and 74
. They have the following bit-values:
74: 001001010
10: 00001010
8: 00001000
0: 00000000
Which tells me that there are at least two other boolean values worth looking into that vc
gives us: vc & 2
and vc & 64
.
I haven't figured out yet what they could mean.
I also confirmed that la
means last active
, and that the a
value corresponds to the following constants:
class X:
OFFLINE = 0
IDLE = 1
ACTIVE = 2
MOBILE = 3
Though I've still only seen it being 0
or 2
Really strange, the reception of 'buddylist_overlay' messages ends few minutes after closing browser... onChatTimestamp still works (with markAlive=True only). JS probability take care of doing some kind of ping (in addition of GET to /active_ping) to maintain 'buddylist_overlay' messages.
Good find for the meaning of 'a' :+1: Only 0 or 2 for me too.
vc could be Voice Capabilities, and the number could indicate which codecs are available (depending of platform, application version...). It's just an hypothesis.
I let my client run for the day, and after a little over 400 buddylist_overlay
-messages, I got the following different values for c
: [None, 8, 10, 74, 2048, 2056, 2122, 4106, 4170, 4186, 8192, 8202, 8208, 8266, 8282, 32842, 36954]
EDIT:
Just for the record, then I got the following counts for the different values of c
:
{8192: 18, 2048: 6, 8266: 2, 74: 94, 8: 54, 4170: 44, 10: 10, 8282: 6, None: 103, 36954: 5, 8208: 8, 2056: 28, 4106: 1, 2122: 15, 4186: 33, 32842: 2, 8202: 2}
And for the different values of vc
:
{0: 135, 8: 82, 74: 201, 10: 13}
c, s and vc are not considered (useful?) Messages end when browser is closed, I'm still trying a solution for that...
In
_parseMessage
, you will recieve a lot of data with the typebuddylist_overlay
. Samplemsg
:The
'a'
(activeness?) value appears in two (and maybe more?) states:0
and2
, where0
means offline and2
means online. The'la'
(last active?) value indicates the timestampThis can be used to know when users become online or when they go offline (in real time, compared to
onChatTimestamp
, which only recieves these updates once in a while).If anybody can figure out what the
c
,s
orvc
values could mean, please let me know (!), otherwise I'll probably make anotheronX
function at some point.