Converse converse.js

Class: Request

Request(elem, func, rid, sendsopt)

Helper class that provides a cross implementation abstraction for a BOSH related XMLHttpRequest.

The Strophe.Request class is used internally to encapsulate BOSH request information. It is not meant to be used from user's code.

Constructor

new Request(elem, func, rid, sendsopt)

Create and initialize a new Strophe.Request object.

Parameters:
Name Type Attributes Default Description
elem Element

The XML data to be sent in the request.

func function

The function that will be called when the XMLHttpRequest readyState changes.

rid number

The BOSH rid attribute associated with this request.

sends number <optional>
0

The number of times this same request has been sent.

Properties:
Name Type Description
id number
sends number
xhr XMLHttpRequest
Source:

Methods

(private) _newXHR() → {XMLHttpRequest}

Private helper function to create XMLHttpRequests. This function creates XMLHttpRequests across all implementations.

Source:
Returns:
Type
XMLHttpRequest

getResponse() → {Element}

Get a response from the underlying XMLHttpRequest. This function attempts to get a response from the request and checks for errors.

Source:
Throws:
  • "parsererror" - A parser error occured.

  • "bad-format" - The entity has sent XML that cannot be processed.

Returns:
  • The DOM element tree of the response.
Type
Element