# qooxdoo

## the new era of web development

### Navigation

- index
- next |
- previous |
- » Home »
- qooxdoo v1.5 documentation »

# Communication

Sending HTTP requests and receiving responses is an important feature of almost every application running in the browser. Most commonly, the technique used is termed Ajax. qooxdoo’s communication stack offers many ways to facilitate HTTP communication at different levels of abstraction.

## Low-level requests

At the very core, HTTP requests from the browser are made by interfacing with the HTTP client API or by adding a script tag to the document. Classes dealing with those low-level transport methods can be found in the `qx.bom.request` namespace. Usually they are not instantiated directly by the user.

`Xhr` is a wrapper of the HTTP client API offered by the browser. It’s purpose is to hide inconsistencies and to work around bugs found in popular implementations. The interface of `qx.bom.request.Xhr` is similar to XMLHttpRequest, the HTTP client API specified by the W3C.

`Script` is a script loader. Internally, the class deals with adding and removing script tags to the document and keeping track of the load status. Just like `qx.bom.request.Xhr`, the interface is modeled based on XMLHttpRequest.

`Jsonp` builds on the script loader and adds functionality needed to receive JSONP responses. JSONP stands for JSON with padding and is a technique to safely receive remote data. It's main advantage compared to to `Xhr` is that cross-origin requests are supported in all browsers.

## Higher-level requests

Classes found in `qx.io.request` build on the groundwork laid by `qx.bom.request`. Properties allow to conveniently setup a request and fine-grained events facilitate handling changes of the request's status or response.

- Higher-level requests
  - Choosing an appropriate transport
  - Basic Setup
  - Events and states
  - Response
  - Authentication
  - Data binding
  - Debugging
  - Specific to XHR
    - Parsing
    - Response
    - Accepting
    - Caching
  - Specific to JSON
    - Callback
    - Caching

Note that historically, qooxdoo comes with two transport layers. The old transport layer is described below.

- AJAX
  - Mimetypes supported
  - Request data
  - Request configuration (properties)
  - Available events
  - Response object
  - Simple example

## REST

`qx.io.rest.Resource` is a client-side wrapper of a REST resource.

- REST (Representational State Transfer)
  - Configuring actions
  - Invoking actions
  - Events
  - Helpers
  - Data binding

## Remote Procedure Calls (RPC)

- RPC (Remote Procedure Call)
  - JSON-RPC Protocol
  - Setup
  - Making remote calls
    - Basic call syntax
    - Parameter and result conversion
    - Aborting a call
    - Error handling
    - Cross-domain calls
  - Writing your own services
    - Java
      - Accessing the session
  - Debugging Backends
  - Creating mockup data
  - qooxdoo JSON-RPC specification
    - Adding to the standard
    - Extending the standard

### RPC Servers

- RPC Server Writer Guide
  - JSON
    - Date Objects
      - Whitespace
      - Numbers
  - RPC
    - request (method invocation)
    - response
  - The Error Object
    - origin
    - code
    - message
  - Other Errors
  - Transport
  - Testing A New Server

## Specific Widget Communication

- Using the remote table model
  - Implement your subclass
    - Using your remote model
    - Sorting your data
  - Backend
  - Summary