https://htmx.org logo
Join Discord
Powered by
# htmx-general
  • f

    future-boots-43048

    12/12/2020, 4:01 PM
    And, for the record, the string concat is at the back of the back end ... the server caches all the web resources, so it doesn't really matter how slow the generation is, it doesn't massively impact latency.
  • m

    mysterious-toddler-20573

    12/12/2020, 4:50 PM
    Speculation: maybe when you do an sse connect, should we setup an event listener on that node? That way if you just want to listen and pass through events for an SSE end point, you only need to do the connect?
  • m

    mysterious-toddler-20573

    12/12/2020, 4:50 PM
    re: string concat, yeah, the perf doesn't bother me, it just looks ugly. I like things looking clean.
  • g

    gorgeous-ghost-95789

    12/12/2020, 4:51 PM
    Your SSE idea sounds like a good one. We already trigger an event when we receive a message, but someone reported that it wasn’t working for them.
  • g

    gorgeous-ghost-95789

    12/12/2020, 4:51 PM
    Sorry, I haven’t gotten to follow up on that. I blame Santa 🎅
  • g

    gorgeous-ghost-95789

    12/12/2020, 4:52 PM
    Anything that interconnects htmx with other tools in the ecosystem would be a good thing.
  • m

    mysterious-toddler-20573

    12/12/2020, 5:15 PM
    https://twitter.com/htmx_org/status/1337808353611841537
  • b

    big-airline-13935

    12/12/2020, 5:47 PM
    Sweet!
  • f

    future-boots-43048

    12/12/2020, 6:49 PM
    Because of the extreme limits on the number of concurrent active SSE connections that you can have, I'm pretty much resigned to having only one SSE connection per page, either on itself, or on a just inside body ... and then each of the (possibly many) "live-updating" components within the page listening to one or more event types that come in through that single shared connection. Practically, the number of hx-sse="connect..." statements is always going to have to be very small.
  • m

    mysterious-toddler-20573

    12/12/2020, 6:50 PM
    Ah, OK
  • m

    mysterious-toddler-20573

    12/12/2020, 6:50 PM
    well, I like the "listen" option, for sure
  • f

    future-boots-43048

    12/12/2020, 6:51 PM
    Yeah. Me too.
  • f

    future-boots-43048

    12/12/2020, 6:51 PM
    It plays nice with hyperscript too.
  • f

    future-boots-43048

    12/12/2020, 7:37 PM
    @User I've made the changes that you wanted, and also updated the documentation. I had a look at tests, but not sure how best to test it.
  • m

    mysterious-toddler-20573

    12/12/2020, 7:37 PM
    OK, let me look at the tests
  • f

    future-boots-43048

    12/12/2020, 7:38 PM
    Thank you very very much for the suggestions, BTW.
  • m

    mysterious-toddler-20573

    12/12/2020, 7:39 PM
    sure, no prob!
  • m

    mysterious-toddler-20573

    12/12/2020, 7:39 PM
    OK, I think a test shouldn't be too hard
  • m

    mysterious-toddler-20573

    12/12/2020, 7:42 PM
    something like this:
  • f

    future-boots-43048

    12/12/2020, 7:42 PM
    I've got a test to make sure it doesn't swap any content in ... just modified from the previous test.
  • m

    mysterious-toddler-20573

    12/12/2020, 7:42 PM
    Copy code
    js
        it('listen syntax works', function () {
            var div = make('<div hx-sse="connect:/foo">' +
                '<div id="d1" hx-sse="listen:e1"></div>' +
                '</div>');
            var called = false;
            htmx.on(byId("d1"), "htmx:sseMessage", function(evt)
            {
                called = true;
            })
            this.eventSource.sendEvent("e1");
            called.should.equal(true);
        })
  • m

    mysterious-toddler-20573

    12/12/2020, 7:43 PM
    OK, yeah, that sounds good too.
  • f

    future-boots-43048

    12/12/2020, 7:43 PM
    OK.
  • f

    future-boots-43048

    12/12/2020, 7:43 PM
    I'll add your test and then update the PR.
  • m

    mysterious-toddler-20573

    12/12/2020, 7:43 PM
    that was all speculative code, not sure if it works 🙂
  • f

    future-boots-43048

    12/12/2020, 7:43 PM
    How do I run the test suite?
  • m

    mysterious-toddler-20573

    12/12/2020, 7:43 PM
    I use WebStorm
  • m

    mysterious-toddler-20573

    12/12/2020, 7:43 PM
    and then you can right click and "Open in browser" and it starts a web server for you
  • m

    mysterious-toddler-20573

    12/12/2020, 7:44 PM
    if you aren't using webstorm, you have to start a webserver in that directory
  • m

    mysterious-toddler-20573

    12/12/2020, 7:44 PM
    there's a way to do it w/ python, hold on
1...979899...1146Latest