mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-02 07:21:05 +00:00
Merge branch 'master' into dev
This commit is contained in:
commit
a6c09931cd
@ -35,7 +35,7 @@ By removing these arbitrary constraints htmx completes HTML as a
|
|||||||
|
|
||||||
```html
|
```html
|
||||||
<!-- Load from unpkg -->
|
<!-- Load from unpkg -->
|
||||||
<script src="https://unpkg.com/htmx.org@1.1.0" ></script>
|
<script src="https://unpkg.com/htmx.org@1.2.0" ></script>
|
||||||
<!-- have a button POST a click via AJAX -->
|
<!-- have a button POST a click via AJAX -->
|
||||||
<button hx-post="/clicked" hx-swap="outerHTML">
|
<button hx-post="/clicked" hx-swap="outerHTML">
|
||||||
Click Me
|
Click Me
|
||||||
|
@ -8,7 +8,7 @@ title: </> htmx - hx-ws
|
|||||||
The `hx-ws` allows you to work with [Web Sockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications)
|
The `hx-ws` allows you to work with [Web Sockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications)
|
||||||
directly from HTML. The value of the attribute can be one or more of the following, separated by commas:
|
directly from HTML. The value of the attribute can be one or more of the following, separated by commas:
|
||||||
|
|
||||||
* `connect:<url>` - A URL to establish an `WebSocket` connection against
|
* `connect:<url>` or `connect:<prefix>:<url>` - A URL to establish an `WebSocket` connection against. Prefixes `ws` or `wss` can optionally be specified. If not specified, HTMX defaults to add the `wss` prefix to the url.
|
||||||
* `send` - Sends a message to the nearest websocket based on the trigger value for the element (either the natural event
|
* `send` - Sends a message to the nearest websocket based on the trigger value for the element (either the natural event
|
||||||
of the event specified by [`hx-trigger`])
|
of the event specified by [`hx-trigger`])
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ Here is an example:
|
|||||||
</div>
|
</div>
|
||||||
```
|
```
|
||||||
|
|
||||||
This example establishes a WebSocket to the `chatroom` end point. Content that is send down from the websocket will
|
This example establishes a WebSocket to the `chatroom` end point. Content that is sent down from the websocket will
|
||||||
be parsed as HTML and swapped in by the `id` property, using the same logic as [Out of Band Swaps](/attributes/hx-swap-oob).
|
be parsed as HTML and swapped in by the `id` property, using the same logic as [Out of Band Swaps](/attributes/hx-swap-oob).
|
||||||
|
|
||||||
The form uses the `send` syntax to indicate that when it is submitted, the form values should be serialized as JSON
|
The form uses the `send` syntax to indicate that when it is submitted, the form values should be serialized as JSON
|
||||||
|
@ -481,7 +481,7 @@ These features are under active development, so please let us know if you are wi
|
|||||||
If you wish to establish a `WebSocket` connection in htmx, you use the [hx-ws](/attributes/hx-ws) attribute:
|
If you wish to establish a `WebSocket` connection in htmx, you use the [hx-ws](/attributes/hx-ws) attribute:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<div hx-ws="connect wss:/chatroom">
|
<div hx-ws="connect:wss:/chatroom">
|
||||||
<div id="chat_room">
|
<div id="chat_room">
|
||||||
...
|
...
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user