Giter Club home page Giter Club logo

Comments (24)

jondubois avatar jondubois commented on June 15, 2024

@seiyria In your console do:
npm remove -g socketcluster
then
npm cache clean

Then follow these steps exactly:
http://socketcluster.io/#!/docs/getting-started

from socketcluster-client.

seiyria avatar seiyria commented on June 15, 2024

I did that exactly, see my project here (it's pretty minimal so far).

from socketcluster-client.

jondubois avatar jondubois commented on June 15, 2024

@seiyria Did you run the socketcluster create myappname command afterwards?

from socketcluster-client.

seiyria avatar seiyria commented on June 15, 2024

@jondubois No, I ran that to generate the project shown above, then I removed the server / serve-static part of it as this will just be a dedicated backend (the frontend is an app).

from socketcluster-client.

jondubois avatar jondubois commented on June 15, 2024

@seiyria So you don't want SC to serve the client file (socketcluster.js) - You want to serve it from somewhere else?

from socketcluster-client.

seiyria avatar seiyria commented on June 15, 2024

@jondubois Yes, I was under the impression that it was a client and the client could be served from anywhere else. Based on your reaction, I suspect that won't work so well. I suppose I could serve just the js file from there and have the app include it, but I prefer to not have external assets (I think Apple has a policy against that, so my app would probably get rejected).

from socketcluster-client.

jondubois avatar jondubois commented on June 15, 2024

That is possible - You can get the client separately and serve it up from anywhere, but it's a bit trickier to setup (manual). Did you use the socketcluster.js file that is inside socketcluster-client/ repo?

from socketcluster-client.

seiyria avatar seiyria commented on June 15, 2024

Yeah, I've tried that as well. My basic code to reproduce was above. It didn't seem to establish a connection.

from socketcluster-client.

jondubois avatar jondubois commented on June 15, 2024

@seiyria Note sure if that could explain the problem but I noticed that there was an outdated socketcluster.js client inside the socketcluster/sample/ app - This was an accident - I removed that file from the module on npm. You should only use the one from the https://github.com/TopCloud/socketcluster-client repo.

from socketcluster-client.

seiyria avatar seiyria commented on June 15, 2024

Absolutely, that's the one I was using.

from socketcluster-client.

jondubois avatar jondubois commented on June 15, 2024

What OS are you using?

from socketcluster-client.

seiyria avatar seiyria commented on June 15, 2024

I'm on OSX for dev. Originally, I tried hosting the server on my linux VM on my windows machine across the network, but I eventually moved it all to my OSX machine to eliminate possible network problems as a cause (though once I have something working I will revisit getting that working).

from socketcluster-client.

jondubois avatar jondubois commented on June 15, 2024

Is your HTTP server running on the same host/domain as the socketcluster server?

from socketcluster-client.

seiyria avatar seiyria commented on June 15, 2024

Yes, currently it is. I'm trying to establish the connection via localhost:8000.

from socketcluster-client.

jondubois avatar jondubois commented on June 15, 2024

What do you get when you run socketcluster -v?

from socketcluster-client.

seiyria avatar seiyria commented on June 15, 2024

Oh, wait, shoot. Something I'll have to take a look at later, actually, I don't think it is. It's running in the iOS simulator, which simulates a device. localhost would probably refer to that device, not the host machine. That doesn't explain why it couldn't connect when given a specific IP, though.

Sorry, this might be a total non-issue; I didn't even think about that. I'll try to resolve this when I'm at my machine next.

Thanks for your support so far!

from socketcluster-client.

jondubois avatar jondubois commented on June 15, 2024

Ok. Let me know.
Thanks for reporting.
If in doubt, raise an issue :)))

from socketcluster-client.

seiyria avatar seiyria commented on June 15, 2024

Hey, so I double checked. Apparently iOS simulator uses the host network, ie, localhost definitely refers to the machine currently running the server.

from socketcluster-client.

jondubois avatar jondubois commented on June 15, 2024

So you didn't manage to get it working on any platform? Did you try to run on Windows directly?

It would be interesting to know what's causing this. I might play around with serving the file from a different origin than the SC server just to see what happens - This should be supported by default though.

from socketcluster-client.

seiyria avatar seiyria commented on June 15, 2024

I have not (I actually have no development tools available to me on windows by design).

It'd be difficult for me to run it all in just linux, as well, as I was unable to get the android simulator working and I can't get the ios simulator on it, so that unfortunately leaves me stuck on OSX. My project is an Ionic app, I should also add. I don't know if that makes a difference though.

Sure, I mean if it works for you, I'm probably screwing something up, but .. who knows.

from socketcluster-client.

jondubois avatar jondubois commented on June 15, 2024

@seiyria I noticed in your first post, you mentioned an 'xhr poll' error - This suggests that you are using version 1.x.x of the client and not the latest 2.x.x version. Could you be using the SC1 client with the SC2 server? The two versions have the same external API but are protocol-incompatible.

Unfortunately, the version number isn't anywhere in the client script (yet) - But to check you can open the socketcluster.js client file and search for the string 'engine.io' - If there are any matches, then it means that you are using v1 of the client.

If that's the issue, make sure you do npm cache clean and then npm install socketcluster-client then get the socketcluster.js file from there - This will be version 2.

npm packages and git branches for SC1 and SC2 have moved around about one or two weeks ago so this could have caused cache issues with npm.

Maybe that's the issue.

from socketcluster-client.

seiyria avatar seiyria commented on June 15, 2024

Absolutely, thank you. I will give this a try when I get back and let you know the results. I was out of ideas!

from socketcluster-client.

seiyria avatar seiyria commented on June 15, 2024

Ah, I figured out why. I bower installed your repo, but you never pushed tags to it, so I got 0.9. I'll try now and see if it works!

from socketcluster-client.

seiyria avatar seiyria commented on June 15, 2024

Yep, and it definitely works now! Thanks for pointing that out. When you attend to #7, make sure you push all your tags :P

Thanks a ton!

from socketcluster-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.