gRPC Transport
Ce contenu n'est pas encore disponible dans votre langue.
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 toBy 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 toThe module includes built-in resilience:
| Scenario | Behavior |
|---|---|
| gRPC available | Uses gRPC transport |
| gRPC unavailable | Falls back to REST |
| Network error | Retries with REST |
Requirements
Anchor link to| Requirement | Version |
|---|---|
| iOS | 13.0+ |
| Xcode | 14.0+ |
| Swift | 5.0+ |
Installation
Anchor link toSwift Package Manager
Anchor link toAdd PushwooshGRPC to your target when integrating the Pushwoosh SDK:
- In Xcode, go to File → Add Package Dependencies
- Enter the package URL:
https://github.com/Pushwoosh/Pushwoosh-XCFramework - Select
PushwooshGRPCin addition to the required frameworks
PushwooshFrameworkPushwooshCorePushwooshBridge
PushwooshGRPC— gRPC transportPushwooshKeychain— Persistent device IDPushwooshLiveActivities— Live Activities supportPushwooshVoIP— VoIP push notificationsPushwooshForegroundPush— Custom foreground notifications
CocoaPods
Anchor link toAdd the gRPC subspec to your Podfile:
target 'MyApp' do use_frameworks!
pod 'PushwooshXCFramework' pod 'PushwooshXCFramework/PushwooshGRPC'endThen run:
pod installUsage
Anchor link toNo code changes required. Once you add the PushwooshGRPC module to your project, it works automatically:
- On app launch, the SDK detects that gRPC transport is available
- API calls are routed through gRPC when possible
- If gRPC fails, the SDK automatically falls back to REST
Supported methods
Anchor link toThe following API methods support gRPC transport:
| Method | gRPC Support |
|---|---|
| Device registration | Yes |
| Tags (set/get) | Yes |
| App open tracking | Yes |
| Push statistics | Yes |
Use cases
Anchor link toThe 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 toVerifying the module is active
Anchor link toCheck the Xcode console logs when your app launches. You should see a log message like:
[Pushwoosh] gRPC transport: ENABLEDForcing REST transport
Anchor link toIf 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.