# Migration from version 3.x

The newest iteration comes with some API breaking change, but don’t worry, these are not game-changers, but rather convenient improvements that open the doors to new future possibilities. During the development process, the goal was to notify and discuss incoming changes within the community as early as possible. You can check here [what has changed since the latest version](https://github.com/marblejs/marble/issues/172).

{% hint style="info" %}
For more detailed info about more low-level improvements, please visit release candidate [changelog](https://github.com/marblejs/marble/releases/tag/v4.0.0-rc.1).
{% endhint %}

## @marblejs/core

{% hint style="danger" %}
Legacy `EffectFactory` builder is no longer available. Please user `r` builder instead.
{% endhint %}

{% hint style="danger" %}
Legacy `switchToProtocol` operator is no longer available.
{% endhint %}

## @marblejs/http

Moved HTTP-related API's from `@marblejs/core` to new package `@marblejs/http`, eg.

**❌ Old (example):**

```typescript
import { HttpRequest, HttpEffect, useContext } from '@marblejs/core';
```

**✅ New (example):**

```typescript
import { useContext } from '@marblejs/core';
import { HttpRequest, HttpEffect } from '@marblejs/http';
```

**HttpOutputEffect -** Improved interface

**❌ Old:**

```typescript
Observable<{ req, res: { status, body, headers } }>
  -> Observable<{ status, body, headers }>
```

**✅ New:**

```typescript
Observable<{ status, body, headers, request }>
  -> Observable<{ status, body, headers, request }>
```

**HttpErrorEffect -** Improved interface

**❌ Old:**

```typescript
Observable<{ req, error }>
  -> Observable<{ status, body, headers }>
```

**✅ New:**

```typescript
Observable<{ error, request }>
  -> Observable<{ status, body, headers, request }>
```

## @marblejs/messaging

**❌ Old:**

```typescript
import { messagingClient, eventBus, eventBusClient } from '@marblejs/messaging';
```

**✅ New:**

```typescript
import { MessagingClient, EventBus, EventBusClient } from '@marblejs/messaging';
```

## @marblejs/websockets

Version 4.x removes deprecated legacy `connection$` attribute. Please use HTTP `upgrade` event for checking connections.

## @marblejs-contrib/middleware-joi

**❌ Old:**

```
npm i @marblejs/middleware-joi
```

**✅ New:**

```
npm i @marblejs-contrib/middleware-joi
```

## @marblejs-contrib/middleware-jwt

**❌ Old:**

```
npm i @marblejs/middleware-jwt
```

**✅ New:**

```
npm i @marblejs-contrib/middleware-jwt
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://marblejs.gitbook.io/docs/other/migration-guides/version-3.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
