-
Notifications
You must be signed in to change notification settings - Fork 80
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
cluster and cordova integration #27
Comments
It's good to know if cluster supports cordova in its current state 👍 |
@banglashi not sure what was the issue is. I am having hard time setting up the cordova dev stuff. Let me try again. |
Hi @arunoda, |
Thanks. On Wed, Mar 18, 2015 at 8:15 PM banglashi [email protected] wrote:
|
Hey @arunoda, Thanks for all your terrific work! Was anyone able to figure out a solution to this? When attempting to run on both iOS simulator or device the ddp call is returning raw html as mentioned by @banglashi. Hence the following error being thrown:
Any point in the right direction would be awesome, would love to get cluster working in my cordova app. Thanks. |
I'm getting a similar error on iOS Meteor-Cordova app running on iPhone 5, although this has nothing to do with Cluster.
Not sure how to debug this, any pointers please? |
Also getting this error - no solutions yet? |
Or workarounds @1nsaneinc @fishdude @arunoda ? |
Started a discussion here: |
Through discussions on the forum, looks like this is caused by connecting to an invalid URL, leading me to believe that Cluster.discoverConnection is returning an invalid endpoint when on cordova. Manually using DDP.Connect works, but isn't as scalable. |
I tried initializing the connection with DDP.connect a few ways, and they all work.
Either the lookup is failing, or the lookup is returning the wrong URL, and then failing when trying to connect with an invalid url. |
Can you debug with weinre (Web inspector remote) or log it or just display the url in a text component etc. and hopefully test it from there too? |
Ok, so here's a little more info, looks like all Cluster.discoverConnection does from a client is call DDP.connect with a '/' prepended to the name of the service passed in. https://github.com/meteorhacks/cluster/blob/master/lib/client/api.js#L2 I'm looking at Meteor's code now to see how that's handled. I don't really understand how that should work on web and not cordova. As is, I'm not even sure why would DDP.connect('/stores') would know that '/stores' is on a different server. https://github.com/meteor/meteor/blob/devel/packages/ddp-client/livedata_connection.js#L52 |
Looks like the endpoint ("/" + serviceName) eventually ends up here: https://github.com/meteor/meteor/blob/devel/packages/ddp-client/stream_client_nodejs.js#L12 According the comments above the contstructor, supported endpoints are
So the way that cluster is connecting is still a bit of a mystery to me. How does '/stores' even translate to connecting to a different server when on web? If I could pick an endpoint on the client, and use the fully qualified url that would probably solve the problem, but I couldn't find a way to pick an endpoint on the client, only on the server. |
@arunoda why does client only use DDP.connect, while the server uses ConnectionWatcher? package.js suggests it could be used for both? |
Okay, this is how This happens in the initial It will get the service and send a sockjs Seems like, it's having some issues in cordova. |
It seems like cordova directly use the Websocket endpoint bypassing sockjs. In order to cluster to work properly it needs sockjs. I am not familiar with cordova code. So, need to dig more. |
@arunoda I don't see how it would ever get there from the client.. My pull request modifies ConnectionWatcher to work on the client as well. The only place it failed was getting the endpoint, so on the client I just have it call to the server to get the endpoint. Is there something wrong with that approach that will cause problems down the line? |
@arunoda @patrickleet |
Very much hope that someone can give me some answers on this issue。 |
@Micjoyce yes, worked for me, and a few others on the forums have used the code from this PR to solve their issues as well. I have a app in production using this. More here: https://forums.meteor.com/t/using-cluster-with-cordova/10678/3 |
@patrickleet this is my test app : https://github.com/Micjoyce/meteor-cluster-accounts-example |
Hi @arunoda,
first of all, thanks for all the great work you are doing for the meteor community ;)
We are trying to build an app and would like to use the cluster package for service-discovery.
As soon as we run the app in the ios simulator or device we get following error:
Basically the ddp call returns the raw html.
I have created a small demo project here https://github.com/banglashi/meteor-cordova-cluster to reproduce the issue. Just edit the CLUSTER_DISCOVERY_URL in the dev and mobile shell scripts.
Than lunch the ./dev script for the search service and the ./mobile script for the web service.
It could be possible that I am doing/setting something wrong. Could it be related to the endpoint being localhost?
Any hint or suggestions is really appreciated.
Best regards
The text was updated successfully, but these errors were encountered: