Skip to content

Releases: iwater/react-native-nitro-http-server

v1.6.0: fix(android): enable 16KB page alignment

25 Feb 05:20

Choose a tag to compare

fix(android): enable 16KB page alignment

Updated so to support 16KB memory pages required by Android 15.

v1.5.2: chore: update to nitro modules 0.32.0 and improve build config

30 Dec 09:43

Choose a tag to compare

chore: update to nitro modules 0.32.0 and improve build config

  • Update dependencies to 0.32.0 versions
  • Add nitro-buffer dependency
  • Make Android SDK versions configurable
  • Simplify package.json structure
  • Bump version to 1.5.2

v1.5.1

25 Dec 08:48

Choose a tag to compare

add files for android platform

v1.5.0

16 Dec 07:06

Choose a tag to compare

Convert Rust libraries to dynamic framework architecture

Summary

transformed Rust libraries from static to dynamic frameworks to resolve symbol conflicts and streamline iOS build process.

Changes

  1. Build Scripts:

    • Updated to generate .dylib instead of .a static libraries
    • Added install_name_tool to fix runtime search paths
    • Modified XCFramework creation to use .framework bundles
    • Simplified library export configuration in Cargo.toml
  2. Podspec Updates:

    • Removed s.libraries = "c++", updated header paths for framework structure
  3. XCFramework Structure:

    • Created proper .framework bundles with Info.plist and binary
    • Framework sizes reduced due to stripped dependencies
    • Removed global symbol exports (no more rust_eh_personality conflicts)

Key Benefits

✅ Resolves iOS symbol conflicts between multiple Rust libraries
✅ Reduces binary size through proper dependency management
✅ Maintains backward compatibility with existing React Native integration
✅ Simplifies iOS build configuration (no manual static linking needed)

The dynamic framework architecture follows iOS best practices and eliminates the need for workarounds like "force load" or symbol renaming, creating a cleaner and more maintainable build system.

v1.4.0

12 Dec 17:24

Choose a tag to compare

Add WebSocket plugin with new onWebSocket API

Summary

Implemented a comprehensive WebSocket plugin with new API design (Scheme B) that provides separate WebSocket event handlers with full access to HTTP upgrade request information.

Changes

  1. TypeScript API (index.ts, HttpServer.nitro.ts):

    • Introduced new onWebSocket(path, handler) API on ConfigServer
    • Added ServerWebSocket class with W3C-compatible API (send(), close(), onmessage, etc.)
    • Enhanced event types with full HTTP upgrade information (path, query, headers)
  2. C++ Bridge (HybridHttpServer.cpp):

    • Implemented WebSocket event forwarding from Rust to JavaScript
    • Added WebSocket operation methods for JavaScript API

Key Features

✅ Full W3C WebSocket API compatibility in JavaScript layer
✅ Separate WebSocket handler API with request context access
✅ Full HTTP upgrade information (path, query, headers) available to handlers
✅ Connection management with unique IDs for message routing
✅ Support for both text and binary message types
✅ Comprehensive error handling and cleanup

API Design

server.onWebSocket('/ws', (ws, request) => {
    console.log('Path:', request.path);
    console.log('Query:', request.query);     // e.g., "token=abc&user=123"
    console.log('Headers:', request.headers); // Full HTTP upgrade headers
    
    ws.onmessage = (e) => {
        ws.send('Echo: ' + e.data);
    };
    ws.onclose = () => {
        console.log('Connection closed');
    };
});

The WebSocket plugin enables real-time bidirectional communication while maintaining full access to HTTP upgrade context, making it suitable for authentication and WebSocket routing scenarios.

v1.3.4

11 Dec 16:37

Choose a tag to compare

Add URL rewrite plugin with regex support

Summary

Implemented a URL rewrite plugin that supports multiple regex-based rewrite rules with capture group replacement functionality.

Changes

  1. Rust Plugin:

    • Created new plugin with RewriteRule struct supporting pattern/replacement pairs
    • Added regex crate dependency for pattern matching
    • Implemented sequential rule processing with capture group replacement
  2. TypeScript Types (HttpServer.nitro.ts):

    • Added RewriteMount interface with rules array
    • Extended Mountable union type to include rewrite plugin
    • Added RewriteRule interface for pattern/replacement configuration
  3. Documentation:

    • Updated README files with plugin description and configuration examples

Key Features

✅ Multiple regex-based rewrite rules in array format
✅ Capture group replacement support ($1, $2, etc.)
✅ Sequential rule processing with first-match wins
✅ Flexible configuration for path transformations

The rewrite plugin enables powerful URL manipulation capabilities similar to nginx rewrite rules, supporting use cases like API versioning, path normalization, and URL cleanup.

v1.3.3

11 Dec 14:48

Choose a tag to compare

Add buffer upload plugin with ArrayBuffer support

Summary

Implemented new Buffer Upload Plugin that processes file uploads in memory and passes data as ArrayBuffer to JavaScript callbacks, along with necessary framework updates.

Changes

  1. Rust Plugin :

    • Created new plugin to handle file uploads in memory (100MB limit)
    • Stores file contents directly into request body as binary data
    • Adds upload metadata (filename, size, content-type) to request headers
  2. TypeScript Definitions (HttpServer.nitro.ts):

    • Added BufferUploadMount interface with type: 'buffer_upload'
    • Updated Mountable union type to include new plugin
    • Enhanced HttpRequest interface with binaryBody?: ArrayBuffer field
  3. C++ Bridge Fix (HybridHttpServer.cpp):

    • Fixed binary data handling for Nitro modules
    • Added proper detection for buffer upload requests via headers
  4. Documentation (README.md, README_zh.md):

    • Added plugin to features list
    • Included configuration examples
    • Updated type definitions and FAQ section
    • Explained differences between disk-based and memory-based uploads

Key Features

✅ In-memory file upload processing (up to 100MB)
✅ Direct ArrayBuffer access in JavaScript callbacks
✅ Seamless integration with existing mount-based architecture
✅ Comprehensive type safety with TypeScript definitions
✅ Fixed C++ compilation issues for binary data handling

The buffer upload plugin provides efficient in-memory processing for smaller files while maintaining compatibility with the existing upload infrastructure.

v1.3.2

11 Dec 07:52

Choose a tag to compare

Add file upload plugin and fix header parsing in C++ bridge

Summary

Implemented a new file upload plugin in Rust and fixed critical header parsing issue in the C++ bridge.

Changes

  1. Rust Upload Plugin:

    • Created upload plugin for handling multipart file uploads
    • Saves uploaded files to configurable temp directory
    • Adds upload metadata to request headers for JS callback processing
  2. TypeScript Types:

    • Added UploadMount interface and integrated into Mountable union type
    • Updated TypeScript definitions to support new plugin type
  3. Documentation Updates:

    • Updated README files with upload plugin examples and documentation
    • Added comprehensive test page for file upload functionality
  4. C++ Bridge Fix:

    • Fixed critical bug where request headers were not being parsed from JSON
    • Headers are now properly deserialized from headers_json field and passed to JS callbacks
    • Removed .value() call from non-optional headers map

Features

✅ File upload support via multipart/form-data
✅ Configurable temporary directory for uploads
✅ Upload metadata passed to JS callbacks
✅ Updated test page with file upload UI
✅ Fixed headers parsing for all request types

The upload plugin enables secure file handling in Rust while maintaining flexibility for JS-based processing logic.

v1.3.1

10 Dec 16:24

Choose a tag to compare

Add release profile optimizations for smaller binary size

v1.3.0

10 Dec 15:36

Choose a tag to compare

Refactor ServerConfig to unified mount-based architecture

Summary

Replaced separate plugin configurations with a unified mounts array in ServerConfig, allowing multiple instances of each plugin type with explicit routing priority control.

Changes

  • TypeScript: Updated ServerConfig interface to support discriminated union types for mounts (webdav, zip, static)
  • Rust backend: Refactored AppHttpServer to dynamically instantiate plugins from mounts array instead of hardcoded registration
  • Plugins: Modified StaticFilePlugin, WebDavPlugin, and ZipMountPlugin to accept mount_path during construction and properly strip prefixes
  • Documentation: Updated README files with new API examples and created detailed refactor plan
  • Tests: Migrated all test cases to new configuration format

Key Features

  • ✅ Unified configuration through mounts array with explicit routing priority
  • ✅ Support for multiple instances of each plugin type
  • ✅ Maintains JS callback as ultimate fallback for unhandled requests
  • ✅ Preserves backward compatibility through root_dir field
  • ✅ Clean separation between static serving and dynamic request handling

The new architecture provides Nginx-like routing flexibility while maintaining the hybrid server model's core principle: static serving first, dynamic JS fallback.