(sigil xmpp connection)
(sigil xmpp connection) - XMPP Connection Lifecycle
Manages XMPP connections with STARTTLS, SASL authentication, resource binding, stanza dispatch, and cooperative I/O.
Exports
xmpp-connectionprocedureConstruct a xmpp-connection struct.
xmpp-connection?procedureTest if a value is a xmpp-connection struct.
xmpp-connection-serverprocedureGet the server field of a xmpp-connection struct.
xmpp-connection-portprocedureGet the port field of a xmpp-connection struct.
xmpp-connection-jidprocedureGet the jid field of a xmpp-connection struct.
xmpp-connection-passwordprocedureGet the password field of a xmpp-connection struct.
xmpp-connection-resourceprocedureGet the resource field of a xmpp-connection struct.
xmpp-connection-stateprocedureGet the state field of a xmpp-connection struct.
xmpp-connection-socketprocedureGet the socket field of a xmpp-connection struct.
xmpp-connection-tls-connprocedureGet the tls-conn field of a xmpp-connection struct.
xmpp-connection-readerprocedureGet the reader field of a xmpp-connection struct.
xmpp-connection-bound-jidprocedureGet the bound-jid field of a xmpp-connection struct.
xmpp-connection-sasl-stateprocedureGet the sasl-state field of a xmpp-connection struct.
xmpp-connection-stanza-handlersprocedureGet the stanza-handlers field of a xmpp-connection struct.
xmpp-connection-event-handlersprocedureGet the event-handlers field of a xmpp-connection struct.
xmpp-connection-iq-callbacksprocedureGet the iq-callbacks field of a xmpp-connection struct.
xmpp-connection-broadcastsprocedureGet the broadcasts field of a xmpp-connection struct.
set-xmpp-connection-state!procedureSet the state field of a xmpp-connection struct.
set-xmpp-connection-socket!procedureSet the socket field of a xmpp-connection struct.
set-xmpp-connection-tls-conn!procedureSet the tls-conn field of a xmpp-connection struct.
set-xmpp-connection-reader!procedureSet the reader field of a xmpp-connection struct.
set-xmpp-connection-bound-jid!procedureSet the bound-jid field of a xmpp-connection struct.
set-xmpp-connection-sasl-state!procedureSet the sasl-state field of a xmpp-connection struct.
set-xmpp-connection-stanza-handlers!procedureSet the stanza-handlers field of a xmpp-connection struct.
set-xmpp-connection-event-handlers!procedureSet the event-handlers field of a xmpp-connection struct.
set-xmpp-connection-iq-callbacks!procedureSet the iq-callbacks field of a xmpp-connection struct.
set-xmpp-connection-broadcasts!procedureSet the broadcasts field of a xmpp-connection struct.
make-xmpp-connectionvariableCreate a new XMPP connection (does not connect yet).
(make-xmpp-connection
server: "example.com"
jid: "bot@example.com"
password: "secret"
resource: "bot")xmpp-connected?procedureCheck if connection is in connected state.
xmpp-on-stanzaprocedureRegister a handler for all incoming stanzas.
xmpp-onprocedureRegister a handler for a specific event type.
Event types: 'message, 'presence, 'iq, 'connected, 'disconnected, 'error
xmpp-channelprocedureGet a channel for receiving events of a given type.
Creates a broadcast subscription. Use with channel-receive or for-channel.
(let ((msgs (xmpp-channel conn 'message)))
(for-channel msgs
(lambda (stanza)
(display (message-body stanza)))))xmpp-sendprocedureSend a stanza (SXML) to the server.
(xmpp-send conn (xmpp-message to: "user@ex.com" body: "Hi"))xmpp-send-rawprocedureSend raw XML string to the server.
xmpp-send-iqprocedureSend an IQ stanza and register a callback for the response.
The callback receives the response stanza.
(xmpp-send-iq conn
(xmpp-iq type: "get" children: '((query (@ (xmlns "jabber:iq:roster")))))
(lambda (response) (display "Got roster\n")))xmpp-send-presenceprocedureSend initial presence to indicate availability.
xmpp-connectprocedureConnect to the XMPP server.
Performs the full XMPP connection sequence: TCP connect -> stream open -> STARTTLS -> SASL auth -> bind
Returns #t on success, #f on failure.
xmpp-disconnectprocedureDisconnect from the XMPP server.
xmpp-process-inputprocedureProcess available input from the XMPP connection.
Returns #t if connection is alive, #f if disconnected.
xmpp-tickprocedureProcess one tick of the XMPP connection (non-blocking).
Returns #t if connection is alive, #f if disconnected.
xmpp-runprocedureRun the XMPP connection event loop.
Processes stanzas until disconnected. When running inside a with-async context, cooperates with other tasks via await-readable. Otherwise blocks in a traditional event loop.