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

    mysterious-toddler-20573

    07/14/2022, 2:52 PM
    lazy loading on separate pages should work fine
  • m

    mysterious-toddler-20573

    07/14/2022, 2:52 PM
    what version of htmx are you using?
  • m

    mysterious-toddler-20573

    07/14/2022, 2:53 PM
    I fixed an issue around the
    load
    event in 1.8. I didn't think the issue made it in to 1.7, but it might have 😑
  • e

    eager-artist-90251

    07/14/2022, 3:56 PM
    Hey everyone, Getting my feet wet at websockets. How can I check the ws extension is loaded and working? I'm trying the minimum:
    Copy code
    html
      <script src="https://unpkg.com/htmx.org/dist/ext/ws.js"></script>
       <!-- the browser gets it, OK -->
      …
      <div hx-ext="ws" ws-connect="ws://localhost:4432/echo">
        WS notifications here:
        <div id="notifications"></div>
      </div>
    On connect, my ws server sends an oob message:
    "<div id=\"notifications\" hx-swap-oob=\"true\"> hello from ws app ! </div>"
    , and the same for any message. I can play with my server with an echo service like https://www.piesocket.com/websocket-tester So, whenever I refresh my test page I was expecting to see a welcome message on the echo test, I do not, and when I send a message from the tester app I was expecting to see my htmx page update. I don't see any activity in the Network tab of the browser dev tools. Thoughts?
  • e

    eager-artist-90251

    07/14/2022, 4:36 PM
    @faint-beach-68980 Did you find your way into HTMX websockets? Is there something to know that isn't in the doc yet, or not in master yet?
  • m

    mysterious-toddler-20573

    07/14/2022, 5:04 PM
    @ripe-action-67367 is the designated web socket expert here
  • r

    ripe-action-67367

    07/14/2022, 5:32 PM
    On it, this should totally work
  • r

    ripe-action-67367

    07/14/2022, 5:49 PM
    Copy code
    html
    <script src="https://unpkg.com/htmx.org"></script>
    <script src="https://unpkg.com/htmx.org/dist/ext/ws.js"></script>
    
    <div hx-ext="ws" ws-connect="wss://demo.piesocket.com/v3/channel_1?api_key=<api_key>¬ify_self">
      WS notifications here:
      <div id="notifications"></div>
    </div>
  • r

    ripe-action-67367

    07/14/2022, 5:52 PM
    I've put this snippet into codepen and it worked right out of the gate (minus the api key in the URL of course)
  • r

    ripe-action-67367

    07/14/2022, 5:54 PM
    Are there any messages in the browser console at all? Does this not work with your server, or with the test endpoint as well?
  • p

    proud-kangaroo-39262

    07/14/2022, 6:12 PM
    Oh gonna be HTMX 1.8 soon, wonder what HTMX 2.0 will be like after 1.8 and 1.9. 🙂
  • t

    tall-dinner-62086

    07/14/2022, 6:28 PM
    htmx 2.0 never ever, maintain backwards compatibility forever
  • p

    proud-kangaroo-39262

    07/14/2022, 7:01 PM
    but 2.0 will be after 1.9, right? 🤔
  • r

    ripe-action-67367

    07/14/2022, 7:31 PM
    could be 1.10
  • t

    tall-dinner-62086

    07/14/2022, 7:35 PM
    That's not how semver works
  • p

    proud-kangaroo-39262

    07/14/2022, 7:36 PM
    oh I dont use semver myself.
  • p

    proud-kangaroo-39262

    07/14/2022, 7:36 PM
    and I dont think it matters, Typescript doesnt use semver either.
  • p

    proud-kangaroo-39262

    07/14/2022, 7:38 PM
    For typescript, it is version 3.0 after 2.9, and 4.0 after 3.9, etc.
  • t

    tall-dinner-62086

    07/14/2022, 7:38 PM
    Do we really want to use typescript as a basis for anything though?
  • p

    proud-kangaroo-39262

    07/14/2022, 7:39 PM
    no, just saying that not all projects follow semver.
  • p

    proud-kangaroo-39262

    07/14/2022, 7:39 PM
    its perfectly normal that after version 1.9, it will be 2.0.
  • g

    gorgeous-airport-54386

    07/14/2022, 7:40 PM
    suddenly i hate typescript
  • t

    tall-dinner-62086

    07/14/2022, 7:40 PM
    I wouldn't call it "normal"
  • p

    proud-kangaroo-39262

    07/14/2022, 7:40 PM
    or you can adopt a hybrid approach, the third number uses semver, first two dont.
  • t

    tall-dinner-62086

    07/14/2022, 7:40 PM
    I don't know if we're following semver but I would very much like to
  • p

    proud-kangaroo-39262

    07/14/2022, 7:40 PM
    again I really dont think semver matters.
  • t

    tall-dinner-62086

    07/14/2022, 7:41 PM
    You've never tried to install a legacy project have you?
  • p

    proud-kangaroo-39262

    07/14/2022, 7:41 PM
    I have, why?
  • t

    tall-dinner-62086

    07/14/2022, 7:41 PM
    Figuring out which versions you can use without semver is a nightmare
  • t

    tall-dinner-62086

    07/14/2022, 7:43 PM
    Is 1.3 compatible with this project that was made with 1.2? Who knows. We know we can't use 1.2 because of a security vulnerability, and we know 2.0 won't work. So let's try 1.3. Oh it had breaking changes. Can we change this bit of code? No one knows because the 12 people who worked on this two decades ago are long gone.
1...745746747...1146Latest