delight-im / Android-DDP

[UNMAINTAINED] Meteor's Distributed Data Protocol (DDP) for clients on Android
Apache License 2.0
274 stars 54 forks source link

onDisconnect : WebSockets connection lost #25

Closed katopz closed 9 years ago

katopz commented 9 years ago

Hi guys,

I'm using present version of Meteor and deploy with mup to DigitalOcean Which all working fine with js client. but I got stuck for native Android (device/emulator x86) somehow.

Here's my code, some other code is just Log for callback

mMeteor = new Meteor(this, "http://123.456.789.00");
mMeteor.setCallback(this);

When I try to connect, it always throw WebSockets connection lost Anyone hit this before? I think I just miss something stupid. uses-permission is set BTW ws:://123.456.789.00 is not working either http://localhost:3000 is not working but this should be emulator issue. http://192.168.2.133:3000 local IP is no luck too.

even worst, sometime it's not call back e.g. after I try registerAndLogin or else. I think I'm doom! Any help would be appreciate.

Thanks

katopz commented 9 years ago

This trick working all the time! Keeping asking and get answer my own!

Here's what I missing

mMeteor = new Meteor(this, "ws://123.456.789.00/websocket");

This is doc somewhere? Am I only one didn't know this /websocket? (shame on me)

Cheers!

ocram commented 9 years ago

Don't worry :)

Great that you found the solution yourself. It's actually mentioned in the documentation three times ;)

Granted, it's never said explicitly that you have to append the /websocket path, but it's shown in the examples. Any idea how we could make this more obvious, though?

katopz commented 9 years ago

@mwaclawek Yes I saw url in doc but it seem like my experiences trick me to skip that because...

and a lot more

You will see that from my experience I never saw and use /websocket before, normally it will route to other page or else and I never know that Meteor /websocket will route to websocket it's just hidden somewhere. And for js version is was like...

ws://localhost:3000/sockjs/055/67slpw9v/websocket

So it's not that obvious to me tho and can be vary. So I try from simple ip and change port and protocol and path later.

In short, No worry! I'm just noob! It's only me that stupid I think.

Any idea how we could make this more obvious, though?

To answer your question here's my noob blog https://medium.com/@katopz/meteor-android-native-1e4ed88ccc16

I mention about this in hint section. :D

Cheers!

ocram commented 9 years ago

Thanks!

Hopefully, others who might have the same problem will find your issue here, then :)

Great tutorial on your Medium blog, by the way!

isdzulqor commented 8 years ago

@katopz would you like to help me to solve my problem, please.. Here's the link https://github.com/delight-im/Android-DDP/issues/47 Thank you