Complete reference for WSX client-side API
options
(Object): Configuration options
url
(string): WebSocket server URLautoConnect
(boolean): Auto-connect on instantiation (default: true
)reconnect
(boolean): Auto-reconnect on connection loss (default: true
)reconnectInterval
(number): Reconnection interval in ms (default: 3000
)maxReconnectAttempts
(number): Maximum reconnection attempts (default: 10
)debug
(boolean): Enable debug logging (default: false
)Promise<void>
: Resolves when connection is establishedboolean
: true
if connected, false
otherwisehandler
(string): Handler name on the servertarget
(string): CSS selector for the target elementdata
(Object): Data to send with the request (optional)options
(Object): Request options (optional)
swap
(string): How to swap the response contenttrigger
(string): Trigger informationtimeout
(number): Request timeout in msPromise<WSXResponse>
: Promise that resolves with the server responsehandler
(string): Handler name on the servertarget
(string): CSS selector for the target elementformElement
(HTMLFormElement): Form element to serializeoptions
(Object): Request options (optional)Promise<WSXResponse>
: Promise that resolves with the server responsehandler
(string): Handler name on the servertarget
(string): CSS selector for the target elementfile
(File): File to uploadoptions
(Object): Request options (optional)
onProgress
(Function): Progress callback functionPromise<WSXResponse>
: Promise that resolves with the server responseevent
(string): Event namecallback
(Function): Event handler functionconnect
: Fired when connection is establisheddisconnect
: Fired when connection is closedmessage
: Fired when a message is receivederror
: Fired when an error occursreconnect
: Fired when reconnection startsreconnected
: Fired when reconnection succeedsevent
(string): Event namecallback
(Function): Event handler function to removeevent
(string): Event namecallback
(Function): Event handler functionresponse
(WSXResponse): Server response objecttarget
(string|HTMLElement): Target element or selectorhtml
(string): HTML content to swapswapType
(string): How to swap the contentinnerHTML
: Replace element’s inner HTMLouterHTML
: Replace the entire elementbeforebegin
: Insert before the elementafterbegin
: Insert as first childbeforeend
: Insert as last childafterend
: Insert after the elementstring
: Unique identifierformElement
(HTMLFormElement): Form element to serializeObject
: Serialized form dataselector
(string): CSS selectorObject
: Parsed selector informationoptions
(Object): Configuration options to updateObject
: Current configurationnumber
: Number of queued requestsurl
(string): WebSocket server URLoptions
(Object): Configuration options (optional)WSX
: New WSX instancestring
: Version stringmessage
(string): Error messagecode
(string): Error codedetails
(Object): Additional error details