Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(mobile): compressed websocket frames for iOS #4794

Closedt3dotgg(GitHub profile, opens in a new tab)wants to merge 5 commits intomain fromt3code/improve-mobile-data-loadingopened View on GitHub

Showing 6 changed files with 235 additions and 0 deletions (loading 3).

x
0 of 6 viewed, 6 left
19 additions and 0 deletionsapps/mobile/modules/t3-websocket/ios/T3WebSocket.podspecAdded
View file
@@ -0,0 +1,19 @@
+Pod::Spec.new do |s|
+ s.name = 'T3WebSocket'
+ s.version = '1.0.0'
+ s.summary = 'URLSession-backed WebSocket for T3 Code mobile.'
+ s.description = 'WebSocket client backed by URLSessionWebSocketTask so iOS negotiates permessage-deflate, which SocketRocket (React Native default) cannot.'
+ s.author = 'T3 Tools'
+ s.homepage = 'https://t3tools.com'
+ s.platforms = {
+ :ios => '18.0',
+ }
+ s.source = { :path => '.' }
+ s.static_framework = true
+​
+ s.dependency 'ExpoModulesCore'
+ s.pod_target_xcconfig = {
+ 'DEFINES_MODULE' => 'YES',
+ }
+ s.source_files = '**/*.{h,m,mm,swift,hpp,cpp}'
+end
210 additions and 0 deletionsapps/mobile/modules/t3-websocket/ios/T3WebSocketModule.swiftAdded
View file
@@ -0,0 +1,210 @@
+import ExpoModulesCore
+import Foundation
+​
+// WebSocket client backed by URLSessionWebSocketTask. React Native's built-in
+// iOS WebSocket (SocketRocket) never offers permessage-deflate, so frames from
+// the T3 server arrive uncompressed. URLSessionWebSocketTask offers the
+// extension in its handshake by default, letting the server (which negotiates
+// permessage-deflate since #4705) compress the JSON RPC stream.