---
title: "Dispatcher API"
url: https://docs.zeroc.com/ice/3.8/runtime/dispatch/dispatcher-api
language: js
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# Dispatcher API

Programming language: JavaScript. Other languages: [C++](https://docs.zeroc.com/ice/3.8/runtime/dispatch/dispatcher-api/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/runtime/dispatch/dispatcher-api/csharp.md), [Java](https://docs.zeroc.com/ice/3.8/runtime/dispatch/dispatcher-api/java.md), [Python](https://docs.zeroc.com/ice/3.8/runtime/dispatch/dispatcher-api/python.md), [Swift](https://docs.zeroc.com/ice/3.8/runtime/dispatch/dispatcher-api/swift.md).

A *dispatcher* accepts an incoming request and returns an outgoing response. Servants, [middleware](https://docs.zeroc.com/ice/3.8/runtime/dispatch/middleware/js.md) and the [dispatch pipeline](https://docs.zeroc.com/ice/3.8/runtime/dispatch/dispatch-pipeline.md) of an object adapter are dispatchers.

A dispatcher is a class derived from [`Ice.Object`](https://code.zeroc.com/ice/3.8/api/javascript/Ice/Object.html) that overrides [`dispatch`](https://code.zeroc.com/ice/3.8/api/javascript/Ice/Object.html#dispatch).

Your implementation of this method handles every request the dispatcher receives, including the requests for `ice_id`, `ice_ids`, `ice_isA` and `ice_ping`: you decide whether and how it handles these four operations. You don't need to override the methods that `Object` provides for them.

## Servants

A *servant* is a dispatcher that handles requests itself, rather than passing them to another dispatcher. A servant usually implements a skeleton that the Slice compiler generates for a Slice interface. The skeleton dispatches each request: it unmarshals the parameters, calls the method you implement for the operation, and marshals the return value and out parameters into the response. It also implements the operations of [Object](https://docs.zeroc.com/ice/3.8/slice/operations-on-object/js.md): `ice_id`, `ice_ids`, `ice_isA` and `ice_ping`.

A servant can also implement the dispatch method itself, without a generated skeleton: it reads the parameters from the request's input stream and writes its results to an output stream. [Input and Output Streams](https://docs.zeroc.com/ice/3.8/runtime/input-and-output-streams/js.md) shows how to read and write Slice types with these streams. You add such a servant to an object adapter like any other servant, in its [active servant map](https://docs.zeroc.com/ice/3.8/runtime/dispatch/active-servant-map/js.md) or as a [default servant](https://docs.zeroc.com/ice/3.8/runtime/dispatch/default-servants/js.md).
