Pular para o conteúdo

gRPC Transport

Este conteúdo ainda não está disponível no seu idioma.

The PushwooshGRPC module provides an optional gRPC transport layer that can improve network performance for communication with Pushwoosh servers. When available, the SDK automatically uses gRPC for supported API methods and falls back to REST if gRPC is unavailable.

How it works

Anchor link to

By default, the Pushwoosh SDK communicates with servers using REST API over HTTPS. The PushwooshGRPC module adds an alternative gRPC transport that offers several advantages:

  • Lower latency — gRPC uses HTTP/2 with persistent connections
  • Smaller payload size — Protocol Buffers are more compact than JSON
  • Multiplexing — Multiple requests can be sent over a single connection

Automatic fallback

Anchor link to

The module includes built-in resilience:

ScenarioBehavior
gRPC availableUses gRPC transport
gRPC unavailableFalls back to REST
Network errorRetries with REST

Requirements

Anchor link to
RequirementVersion
iOS13.0+
Xcode14.0+
Swift5.0+

Installation

Anchor link to

Swift Package Manager

Anchor link to

Add PushwooshGRPC to your target when integrating the Pushwoosh SDK:

  1. In Xcode, go to File → Add Package Dependencies
  2. Enter the package URL: https://github.com/Pushwoosh/Pushwoosh-XCFramework
  3. Select PushwooshGRPC in addition to the required frameworks
  • PushwooshFramework
  • PushwooshCore
  • PushwooshBridge

Add the gRPC subspec to your Podfile:

target 'MyApp' do
use_frameworks!
pod 'PushwooshXCFramework'
pod 'PushwooshXCFramework/PushwooshGRPC'
end

Then run:

Terminal window
pod install

No code changes required. Once you add the PushwooshGRPC module to your project, it works automatically:

  1. On app launch, the SDK detects that gRPC transport is available
  2. API calls are routed through gRPC when possible
  3. If gRPC fails, the SDK automatically falls back to REST

Supported methods

Anchor link to

The following API methods support gRPC transport:

MethodgRPC Support
Device registrationYes
Tags (set/get)Yes
App open trackingYes
Push statisticsYes

The PushwooshGRPC module is particularly useful for:

  • High-frequency event tracking — Reduced overhead for apps that send many events
  • Real-time applications — Lower latency for time-sensitive operations
  • Bandwidth-constrained environments — Smaller payload sizes save data

Troubleshooting

Anchor link to

Verifying the module is active

Anchor link to

Check the Xcode console logs when your app launches. You should see a log message like:

[Pushwoosh] gRPC transport: ENABLED

Forcing REST transport

Anchor link to

If you need to disable gRPC temporarily for debugging, you can remove the PushwooshGRPC module from your target. The SDK will automatically use REST transport when gRPC is not available.