Hello everyone,
It’s my second full day of debugging and still can’t find a solution for my problem.
My application iOS/Android:
- CapacitorJS v.5
- Vue3
consider capacitor.config.json:
"CapacitorHttp": { "enabled": true }
I am using CapacitorHttp to intercept XMLHttpRequest and make it natively, because it’s the way it works all my API consuming, Apple Sign In, Google Sign In, etc… so I can’t really just disabled it.
Said that, my problem comes now trying to have a Socket.IO connection for a chatbot.
Server is configured:
python-socketio==5.3.0
python-engineio==4.2.1
eventlet==0.31.0
flask==2.0.2
aiohttp==3.8.1
flask-cors==3.0.10
sio = socketio.Server(
cors_allowed_origins='*',
cors_credentials=True,
transports=['websocket', 'polling']
)
Client is configured:
"socket.io-client": "^4.7.5" //package.json
//socketService.ts
import { io } from 'socket.io-client';
export const socket = io('wss://my-server.com', { withCredentials: true });
Running on browser it works correct!
Connection is successful… client and server communicates perfectly!
Running on Native App (simulator and real device | iOS and Android) I get HTTP 400 from server with this message:
The client is using an unsupported version of the Socket.IO or Engine.IO protocols
Considering that browser works fine, I can assume that problem here isn’t really the version of my Socket.IO on client package.json… but some interference of capacitorHttp intercepting my WS request and, using inner dependencies that I haven’t access, conflicts with server and fail my request.
If I set “CapacitorHttp”: { “enabled”: false } then Socket connection works on native App, but all my other APIs and Native Logins request fail.
- I have investigate about deactivating CapacitorHttp plugin ONLY for ws:// requests, but couldn’t make it (accordingly to documentation isn’t even possible).
Does anyone have an idea what I can do here?
Any help is welcome