Code Monkey home page Code Monkey logo

dweetio-client's Issues

listen_for gets wrong port por connection to dweet.io

I just followed your example in the readme and the "try out" page on https://dweet.io/

My test page is served at: http://localhost:63342/index.html (note the port)

index.hml:

<script src="//dweet.io/client/dweet.io.min.js"></script>
<script>
    // dweetio.set_server("https://dweet.io:443", true);
    // dweetio.set_server("http://dweet.io:80", false);

    dweetio.listen_for("magenta-cap", function(dweet) {
        console.log("dweet.content=", dweet.content);
    });
</script>

But this is failing as shown in the console
image
Note that it's trying to connect to https://dweet.io:63342 (same port as my local sever!)

If I uncomment any of the set_server statements above to force the port, everything works ok.

Scoping issue with socket.io

I ran into an issue when trying to use listen_for. The specific error is that io is undefined on this line. Breaking on that line, I saw that window.io was defined, but io was not. I think it might be because the script's closure is forcing the scope to use this variable instead of the globally declared one from the socket.io script.

I made simple patch that solved my problem here but it is a little hackish. Would you like me to PR it?

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.