---
title: "Epsilon Networking"
canonical_url: "https://apidocs.sportradar.com/resources/epsilon-sdk/docs/modules/networking"
markdown_url: "https://apidocs.sportradar.com/resources/epsilon-sdk/docs/modules/networking.md"
last_updated: "2026-06-15T10:09:12Z"
---

# Epsilon Networking

The `epsilon-networking` module provides a robust, type-safe networking layer built on top of [Ktor](https://ktor.io). It is designed to handle common networking tasks such as request execution, response deserialization, and structured error resolution.

> **Tip**
>
> This module is a common starting point when shared code needs a reusable HTTP client abstraction across platforms.

## Features

- **Ktor Integration**: Fully compatible with Ktor's client and features.
- **Type-Safe Responses**: Uses `NetworkResponse<R>` to represent success or failure.
- **Structured Error Handling**: Built-in error resolution mechanism to map HTTP errors to domain models.
- **Multiplatform Support**: Works on Android, iOS, JVM, and JavaScript.
- **JSON Serialization**: Pre-configured Kotlinx Serialization.

## Supported Platforms

- Android
- iOS
- JVM
- JavaScript

## Key Components

### Networking Class

The main entry point for making network requests. It supports `GET`, `POST`, `PUT`, and `DELETE` methods.

**Request example**

```kotlin
val networking = Networking(
    prioritizedErrorResolvers = listOf(MyNetworkErrorResolver()),
    userAgent = "MyApp/1.0.0"
)

val response: NetworkResponse<User> = networking.get(Url("https://api.example.com/user/1"))
```

### NetworkResponse

A data class that represents the outcome of a network call. It contains either the successful `data` or an `HttpError`.

```kotlin
val response: NetworkResponse<User> = ...

if (response.isSuccess) {
    val user = response.data // Depending on the type T, may be null even when isSuccess == true
} else {
    val error = response.error // Will not be null if isSuccess == false
}
```

#### Unwrapping

You can use the `unwrap` method to handle both cases in a functional style:

> **Note**
>
> `unwrap` is useful when you want to keep success and failure handling together in one expression.

```kotlin
val result = response.unwrap(
    onSuccess = { data -> "Success: ${data.name}" },
    onFailure = { error -> "Error: ${error.message}" }
)
```

### Error Resolution

The `NetworkErrorResolver` interface allows you to define custom logic for parsing error bodies from failed requests.

## Usage

Add the dependency to your `commonMain`:

```kotlin
dependencies {
    implementation("ag.sportradar.mobile.epsilon:epsilon-networking:<version>")
}
```
