Bots caught the emit-after-remove race: delegate callbacks deferred the
emit onto the serial queue then removed the emitter synchronously, so
close/error events never reached JS. Emits now run synchronously on the
queue before removal. Also cleans up activeSockets when connect throws,
and imports "expo" lazily so test import chains touching runtime.ts do
not evaluate expo's dev-only setup (CI __DEV__ failure).
Co-Authored-By: Claude Fable 5 <[email protected]>
React Native's iOS WebSocket is backed by SocketRocket, which never offers
permessage-deflate, so the server-side negotiation from #4705 only benefited
Android (OkHttp offers it by default). This adds a URLSessionWebSocketTask-
backed Expo module (URLSession offers the extension in its handshake) and
injects it as the Effect Socket constructor on iOS only, with a fallback to
the global WebSocket on Android and on binaries predating the module.
Co-Authored-By: Claude Fable 5 <[email protected]>