Skip to content

Commit 75a34ff

Browse files
g-gundamgg
andauthored
Attempt websocket reconnection on error code 1011 also (#167)
This error code is documented in RFC 6455, and it's what hunchensocket (a websocket server for Common Lisp) uses to signal websocket closure due to timeout. I think this is a small and reasonable change. https://datatracker.ietf.org/doc/html/rfc6455 Search for 1011 Co-authored-by: gg <gg@nowhere>
1 parent fd25e24 commit 75a34ff

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/ws/ws.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ This extension adds support for WebSockets to htmx. See /www/extensions/ws.md f
253253
socket.onclose = function(e) {
254254
// If socket should not be connected, stop further attempts to establish connection
255255
// If Abnormal Closure/Service Restart/Try Again Later, then set a timer to reconnect after a pause.
256-
if (!maybeCloseWebSocketSource(socketElt) && [1006, 1012, 1013].indexOf(e.code) >= 0) {
256+
if (!maybeCloseWebSocketSource(socketElt) && [1006, 1011, 1012, 1013].indexOf(e.code) >= 0) {
257257
var delay = getWebSocketReconnectDelay(wrapper.retryCount)
258258
setTimeout(function() {
259259
wrapper.retryCount += 1

0 commit comments

Comments
 (0)