Skip to content

Conversation

@rafaelmf3
Copy link
Contributor

@rafaelmf3 rafaelmf3 commented Jan 19, 2026

Submit a pull request

CLA

  • I have signed the Stream CLA (required).
  • The code changes follow best practices
  • Code changes are tested (add some information if not applicable)

Description of the pull request

Summary

Adds support for configuring the x-stream-ext header in the Stream Chat Java SDK. This header allows clients to pass additional metadata (such as device information, app version, etc.) that will be included in the request_info.ext field for webhooks and other backend processing.

What Changed

  • Added X_STREAM_EXT_PROP_NAME constant for the configuration property
  • Updated extendProperties() method to read x-stream-ext value from environment variables or system properties
  • Added getXStreamExt() helper method to retrieve the configured value
  • Updated the HTTP interceptor in buildOkHttpClient() to include the X-Stream-Ext header in all requests when configured

Why

This feature aligns the Java SDK with other Stream Chat SDKs (JavaScript, Flutter, Python) that already support the x-stream-ext header. The backend expects this header and includes it in the request_info.ext field, which is useful for:

  • Passing device information to webhooks
  • Including app version metadata
  • Custom client-side information for moderation/fraud detection
  • Any other custom metadata needed by the backend

Usage

The x-stream-ext header can be configured in three ways:

**1. Via Properties object:**va
var properties = new Properties();
properties.put(DefaultClient.API_KEY_PROP_NAME, "");
properties.put(DefaultClient.API_SECRET_PROP_NAME, "");
properties.put(DefaultClient.X_STREAM_EXT_PROP_NAME, "device-id=123");
var client = new DefaultClient(properties);
DefaultClient.setInstance(client);

@rafaelmf3 rafaelmf3 self-assigned this Jan 20, 2026
@rafaelmf3 rafaelmf3 merged commit ec4843a into main Jan 20, 2026
1 check passed
@rafaelmf3 rafaelmf3 deleted the cha-1558-support-ext-custom-header branch January 20, 2026 18:49
@rafaelmf3 rafaelmf3 mentioned this pull request Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants