venomous0x / WhatsAPI

Interface to WhatsApp Messenger
2.59k stars 2.14k forks source link

unable to connect to c.whatsapp.net:5222 #372

Open Mittchel opened 11 years ago

Mittchel commented 11 years ago

Hey there,

I'm getting the following error: unable to connect to c.whatsapp.net:5222 when trying to send a message. This is weird, because requesting the code actually works.. I'm getting a SMS with the code from whatsapp.. so I'm not sure what's wrong.

Anyone knows what this could be?

shirioko commented 11 years ago

Requesting a code uses a different host and protocol (https://v.whatsapp.net).

Are you using the original repository from here or my fork? Try mine, I've replaces all socket functions with file handles which should work a lot cleaner.

Mittchel commented 11 years ago

@shirioko I actually forked yours mate. The .NET version doesn't work for me either.. By the way if you're creating an iOS app which integrates WhatsApp functionality is this considered illegal?

shirioko commented 11 years ago

Maybe a firewall on your end blocking traffic on port 5222? Are you able to ping c.whatsapp.net?

EDIT Their ToS state that you're not allowed to generate more load/traffic than a regular user and that you're not allowed to reverse-engineer their protocol, and that's pretty much it. I don't think their proprietary FunXMPP protocol is licensed so you should be able to use that without getting in trouble.

Mittchel commented 11 years ago

@shirioko I'm currently at work, so I've to hold you on the ping question.

About the amount of traffic.. is it possible to create a serious messenger app for WhatsApp or do you think the amount of load/traffic you are eligible to is too low to create such an app?

Are you limited in the amount of messages per minute or how is the load controlled?

shirioko commented 11 years ago

I'm working on my own WhatsApp desktop client and there are a number of other projects on GitHub aiming for the same goal. I've had no trouble with blocking so far while spamming my test account, so I think that their blocking policy is not only based on a traffic limit but also on the accounts you are trying to contact.

Don't tell anyone but I came across this: https://github.com/shirioko/WhatsAPI/commit/11fa519b1734fc10f8140d5d247e875f24795ef3 which would mean that WhatsApp maintains a server-side address book per account. Syncing all of your contacts using contactSyncV2 before sending messages might get you out of the kill zone ;-)

Mittchel commented 11 years ago

Sounds great. @shirioko thanks for the help and heads up.. appreciate your help and fast responses. I might have an idea which I would like to address you with. Would you mind if I send you a e-mail so you can give your opinion on the idea?

shirioko commented 11 years ago

Sure go ahead!

Mittchel commented 11 years ago

Done! Sent the e-mail in dutch though.