My library (Wampy.js) relies on Websocket subprotocols for communication with server.
In RN environment developers faced a problem with initializing ws connection. After a long investigation we found that problem is that after websocket connection is established and onopen callback is fired, protocol property of websocket instance is undefined, but it must contain subprotocol choosen by server.
Analyzing network packets it's clear, that RN client sends Sec-WebSocket-Protocol header, and server responds with approciate Sec-WebSocket-Protocol header value.
React Native version:
info
React Native Environment Info:
System:
OS: macOS 10.14.4
CPU: (4) x64 Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz
Memory: 808.31 MB / 24.00 GB
Shell: 5.7.1 - /usr/local/bin/zsh
Binaries:
Node: 11.14.0 - /usr/local/bin/node
npm: 6.9.0 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 28
Build Tools: 28.0.3
IDEs:
Android Studio: 3.4 AI-183.5429.30.34.5452501
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.5 => 0.59.5
Steps To Reproduce
Clone https://github.com/zaytsevfuu/wampytest
yarn install
node node_modules/react-native/local-cli/cli.js run-android
yarn run start
cd crossbar && ./start_wamp.sh
Describe what you expected to happen:
onConnect callback is called
You can find more info in related issue KSDaemon/wampy.js#107
My library (Wampy.js) relies on Websocket subprotocols for communication with server.
In RN environment developers faced a problem with initializing ws connection. After a long investigation we found that problem is that after websocket connection is established and
onopencallback is fired,protocolproperty of websocket instance is undefined, but it must contain subprotocol choosen by server.Analyzing network packets it's clear, that RN client sends
Sec-WebSocket-Protocolheader, and server responds with approciateSec-WebSocket-Protocolheader value.React Native version:
Steps To Reproduce
Clone https://github.com/zaytsevfuu/wampytest
yarn install
node node_modules/react-native/local-cli/cli.js run-android
yarn run start
cd crossbar && ./start_wamp.sh
Describe what you expected to happen:
onConnectcallback is calledYou can find more info in related issue KSDaemon/wampy.js#107