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

    narrow-chef-14221

    11/24/2020, 3:20 PM
    @User I was looking at https://htmx.org/examples/modal-bootstrap/ and I think there might be an error. On the examples you have
    <div id="show-modals-here"></div>
    but then I think you're trying to get a reference to that element using the wrong id:
    var container = document.getElementById("modals-here")
    .
  • m

    mysterious-toddler-20573

    11/24/2020, 3:21 PM
    entirely possible, @User any thoughts?
  • g

    gorgeous-ghost-95789

    11/24/2020, 3:25 PM
    Sounds like a cut and paste mistake. Sorry. I can update that.
  • m

    mysterious-toddler-20573

    11/24/2020, 3:26 PM
    no worries, thanks again for the examples 👍
  • m

    mysterious-toddler-20573

    11/24/2020, 4:00 PM
    https://twitter.com/htmx_org/status/1331266082254974977
  • b

    bulky-shampoo-83645

    11/24/2020, 11:41 PM
    Hello I'm new here 👋 I need to build an ephemeral realtime chat feature to add to my jamstack event site (built with 11ty, AlpineJS and some video APIs). I cannot find an out of the box decent "chat widget" that I can drop in since they all seem to be overfeatured or overstyled for my purpose. Would HTMX be suitable with firebase as a backend to create a realtime chat stream which will not need to persist beyond the end of the event? If so I would value some pointers on an approach to tackling this. Thanks.
  • m

    mysterious-toddler-20573

    11/24/2020, 11:55 PM
    Hi @User it wouldn't be terrible, but it wouldn't be great either, IMO. Chat is right on the edge of what I consider htmx ideal for, and it wouldn't be a trivial problem (not that it's a trivial problem in other options)
  • m

    mysterious-toddler-20573

    11/24/2020, 11:55 PM
    You could set up a chat box that does a post to an end point for the event, and then use web sockets or SSE (or just polling) for the main chat window.
  • m

    mysterious-toddler-20573

    11/24/2020, 11:56 PM
    Not awful, but it would involve some pretty advanced web stuff, not just a quick hit
  • b

    bulky-shampoo-83645

    11/25/2020, 12:00 AM
    Thanks, I suspected that it might be possible by posting to the Firebase realtime DB from a chatbox on each client, then also having each client subscribe to a socket of the Firebase query (it can publish socket feeds out of the box)... but I reckon this might get pretty messy in a long chat stream, and those are a guarantee nowadays! I also worry that the user experience might be laggy compared to the realtime chat people have become accustomed to
  • b

    bulky-shampoo-83645

    11/25/2020, 12:01 AM
    So if anyone knows a decent realtime chat widget / service 😉
  • g

    gorgeous-ghost-95789

    11/25/2020, 1:33 AM
    This is exactly what I’m working on now. I’m building it with SSE, which seems to be the best solution for this case. WebSockets are “more powerful” but also more error prone.
  • g

    gorgeous-ghost-95789

    11/25/2020, 1:34 AM
    The hard part is the back end. I’m building my chat box in Go, which is awesome for this case, but there’s just a lot of infrastructure to put together.
  • g

    gorgeous-ghost-95789

    11/25/2020, 1:35 AM
    I’m afraid I don’t have a lot to share (just yet) but I’m happy to trade notes with you @bulky-shampoo-83645 (via DM, GitHub, or email) if you’d like.
  • g

    gorgeous-ghost-95789

    11/25/2020, 1:37 AM
    I agree with @mysterious-toddler-20573 that it’s pushing the envelope of HTMX a bit, but it’s very doable. And if HTMX falls short, maybe we’ll just make a few good pull requests to fill in the gaps.
  • b

    bulky-shampoo-83645

    11/25/2020, 7:42 AM
    Thanks @User I will DM you to share notes
  • b

    bulky-shampoo-83645

    11/25/2020, 7:42 AM
    If we ever come up with something good we can share it back to the group here
  • m

    mysterious-toddler-20573

    11/25/2020, 1:28 PM
    finally got file upload progress working properly
  • b

    big-airline-13935

    11/25/2020, 2:14 PM
    Nicely done, those htmx API functions (find, trigger, etc) might be handy to have documented.
  • m

    mysterious-toddler-20573

    11/25/2020, 2:55 PM
    😑
  • m

    mysterious-toddler-20573

    11/25/2020, 2:56 PM
    https://htmx.org/api/
  • b

    big-airline-13935

    11/25/2020, 3:36 PM
    Aha, must have missed that, thanks!
  • f

    future-boots-43048

    11/25/2020, 5:59 PM
    It looks to me like each element can only have a single SSE event source. Is this correct?
  • f

    future-boots-43048

    11/25/2020, 6:00 PM
    Line 1059:``` getInternalData(elt).sseEventSource = source;```
  • f

    future-boots-43048

    11/25/2020, 6:01 PM
    So it appears that the last event source defined for an element will be the one that's used ...
  • m

    mysterious-toddler-20573

    11/25/2020, 6:01 PM
    https://htmx.org/attributes/hx-sse/
  • m

    mysterious-toddler-20573

    11/25/2020, 6:01 PM
    You should be able to put multiple sources in a nested manner
  • f

    future-boots-43048

    11/25/2020, 6:02 PM
    That's what I'm thinking.
  • g

    gorgeous-ghost-95789

    11/25/2020, 6:02 PM
    Yeah. Single "connect:" statement, multiple "swap:" statements.
  • f

    future-boots-43048

    11/25/2020, 6:02 PM
    The woding of the documentation wasn't 100% clear to me ...
    Copy code
    The value of the attribute can be one or more of the following, separated by white space:
1...757677...1146Latest