module XMPP::AltConnectionResolver

Overview

XEP-0156 (v1.4.0): discovers WebSocket and BOSH endpoints from the HTTPS host-meta document (XRD XML or JRD JSON). The DNS _xmppconnect TXT method was removed from the spec and is deliberately not implemented.

Extended Modules

Defined in:

xmpp/alt_connections.cr

Constant Summary

BOSH_REL = "urn:xmpp:alt-connections:xbosh"
JRD_PATH = "/.well-known/host-meta.json"
WEBSOCKET_REL = "urn:xmpp:alt-connections:websocket"
XRD_PATH = "/.well-known/host-meta"

Instance Method Summary

Instance Method Detail

def discover(domain : String, config : Config | Nil = nil, fetcher : String -> String | Nil = ->(url : String) do https_get(url, config) end) : Array(AlternativeEndpoint) #

Discovers alternative endpoints, ordered WebSocket before BOSH and wss/https before ws/http. Fetches the XRD document first and falls back to JRD when XRD yields no alt-connection links.


[View source]
def https_get(url : String, config : Config | Nil = nil) : String | Nil #

Fetches a URL over HTTPS with normal certificate verification (honoring the configured CA bundle). Returns nil on any transport or TLS failure.


[View source]