Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a natural language spec of the FB protocol? #145

Open
shymega opened this issue May 24, 2017 · 7 comments
Open

Make a natural language spec of the FB protocol? #145

shymega opened this issue May 24, 2017 · 7 comments

Comments

@shymega
Copy link

shymega commented May 24, 2017

Just had an idea. What would be the feasibility of creating a natural language specification of the FB Messenger protocol, for those who need a quick reference without having to delve into the C code?

Of course, I foresee that this may not be possible, because of FB's T&Cs, but I thought I'd ask anyway.

Thanks.

@dequis
Copy link
Member

dequis commented May 24, 2017

Of course, I foresee that this may not be possible

Not sure what you had in mind there, but whatever it is, it's not a problem

The only reason there are no docs is that no docs have been written

@shymega
Copy link
Author

shymega commented May 24, 2017

Honestly, I'm not sure either.

I'm trying to decipher the C code, but I'm not sure where to start. I wanted to start documenting how FB's MQTT API works.

@dequis
Copy link
Member

dequis commented May 24, 2017

Get an editor that lets you jump through functions easily (I personally use vim with * or ^] and ctags) and start with fb_login in facebook.c. That starts the login and sets the callbacks that determine the flow of everything else.

Then jump like fb_api_connect -> fb_mqtt_open -> fb_mqtt_cb_open -> fb_api_cb_mqtt_open. Figure out how those functions call each other and how signals work, then extrapolate the pattern to the rest. Complement with debug output of actually running the thing, the hexdumps help a lot.

Most of the meat is in facebook-api.c. -data.c is generic storage, -http.c is a generic http client wrapper, -json.c is a generic json library wrapper, -mqtt.c is a generic (probably standard) mqtt implementation, -thrift.c is a generic compact thrift serializer and -util.c is generic garbage.

facebook-api.h has important stuff too. Also some constants in facebook-mqtt.h.

@dequis
Copy link
Member

dequis commented May 24, 2017

@shymega
Copy link
Author

shymega commented May 25, 2017

@dequis Thanks for the information. Your website helped.

I will get my editor - Emacs - to use ctags to jump through the functions later, once my exam is over today.

I guess the next big step is to figure out the model that Thrift uses, from what I've seen on your website?

@shymega
Copy link
Author

shymega commented Sep 26, 2017

Update: I'll be honest, I haven't got very far with this.
I'm not the best with C, and its all a bit confusing.. so I might leave this for a bit.

Apologies.

@shymega
Copy link
Author

shymega commented Sep 26, 2017

I tried to connect to mqtt.facebook.com on port 443 though with Paho, and it doesn't seem to like being connected to like that, which is rather odd. Just thought I'd mention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants