Перейти к содержимому

Xhr poll error что это

  • автор:

Xhr poll error что это

The MOTD can be formatted using a subset of HTML. Tags which attempt to execute Javascript will be removed.

CSS editor

Maximum size 20KB. If more space is required, use the External CSS option under General Settings to link to an externally hosted stylesheet.

JS editor

Maximum size 20KB. If more space is required, use the External JS option under General Settings to link to an externally hosted stylesheet.

Ban list
Unban IP Name Banned by

Saved searches

Use saved searches to filter your results more quickly

Cancel Create saved search

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xhr poll error and websocket error on android react native when connecting #1558

proohit opened this issue Oct 24, 2022 · 10 comments

xhr poll error and websocket error on android react native when connecting #1558

proohit opened this issue Oct 24, 2022 · 10 comments
to triage Waiting to be triaged by a member of the team

Comments

proohit commented Oct 24, 2022

Describe the bug
Getting an error on connection, xhr poll error both with polling and websocket transports on Android with React Native. cURL and iOS both work without problems. For reference:

curl http://localhost:7777/socket.io/\?EIO\=4\&transport\=polling\&t\=OGBFaH0 0

I tried to log the underlying xhr error from polling.js and got the following log:

xhr poll error 0 , "_incrementalEvents": false, "_lowerCaseResponseHeaders": <>, "_method": "GET", "_perfKey": "network_XMLHttpRequest_http://localhost:7777/socket.io/?EIO=4&transport=polling&t=OGBFaH0", "_performanceLogger": , "_pointExtras": <>, "_points": , "_timespans": >, "_requestId": null, "_response": "Failed to connect to localhost/127.0.0.1:7777", "_responseType": "", "_sent": true, "_subscriptions": [], "_timedOut": false, "_trackingName": "unknown", "_url": "http://localhost:7777/socket.io/?EIO=4&transport=polling&t=OGBFaH0", "readyState": 4, "responseHeaders": undefined, "status": 0, "timeout": 0, "upload": <>, "withCredentials": false> 

To Reproduce

«@nestjs/platform-socket.io»: «^9.1.6» which uses «socket.io»: «4.5.3»

import  OnGatewayConnection, WebSocketGateway, WebSocketServer, > from '@nestjs/websockets'; import  Server, Socket > from 'socket.io'; @WebSocketGateway(7777,  cors:  origin: '*' >>) export class WebSocketService implements OnGatewayConnection  @WebSocketServer() server: Server; async handleConnection(client: Socket)  console.log('new client has connected'); > >

Socket.IO client version: 4.5.3

import  io > from "socket.io-client"; const socket = io("ws://localhost:7777/", >); socket.on("connect", () =>  console.log(`connect $socket.id>`); >); socket.on("disconnect", () =>  console.log("disconnect"); >);

Platform:

  • Device: Android Emulator (Pixel 3a API 33)

The text was updated successfully, but these errors were encountered:

Receiving Error: xhr poll error socket.io client React

I am receiving an Error: xhr poll error in the connect_error event when trying to connect to my websocket gateway. I am using «socket.io-client»: «^4.2.0» .

import < io >from "socket.io-client"; const ENDPOINT = "http://localhost:3001"; const socket = io(ENDPOINT); socket.on("connect_error", (e: any) => < console.log(e); >); 

asked Oct 5, 2021 at 12:29
Vladimir Vladimirov Vladimir Vladimirov
269 1 1 gold badge 2 2 silver badges 14 14 bronze badges
New versions of socket.io requires also cors on server side. socket.io/docs/v4/handling-cors
Oct 5, 2021 at 12:40

2 Answers 2

You can try to set up the client connection to use only websocket transport. By default it is using weboscket and polling.

So your code will become:

const socket = io(ENDPOINT, < transports: ['websocket'] >); 

answered Oct 5, 2021 at 12:31
Boris Mutafov Boris Mutafov
337 3 3 silver badges 7 7 bronze badges
you just saved my day, thanks a lot
Jul 19, 2023 at 1:50

set server.listen instead of

 app.listen 

answered Sep 17, 2022 at 12:29
mohammed kalash mohammed kalash
19 5 5 bronze badges

  • javascript
  • reactjs
  • websocket
  • socket.io
    The Overflow Blog
Related
Hot Network Questions

Subscribe to RSS

Question feed

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2024 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2024.1.8.3130

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Xhr poll error что это

Ant

03.10.2017
09:52:53
у всех кроме тплинк, тадам!

дада, помню в сохо впн маршрутизаторах такое было

но справедливости надо сказать ради

они таки прошивки то выпускают для ремонта этого всего

ну и ещё качество нашей русскоязычной поддержки было отвратительным

Google

Ant

03.10.2017
09:53:32

я стал писать напряму узкоглазым в их кривую багтрекилку

в итоге всё резко както стало резвей и чётче.

Denis 災 nobody

03.10.2017
09:54:10

а так можно было? )))

VLAD

03.10.2017
10:23:02

завел пользователя указал мак и все пошел ставить телефон)) я даже удивлен что до некоторых дошли такие технологии обычно же ручками

То же самое у меня,циски спа.эндпоинт менеджер перепиленые конфиги и все радости жизни,например собираемая с удаленных участков телефонная книга xml,+ еще то что редко кто использует- тел книга астериска тоже хмл но для мобильных сотрудников.удобно поправил в базе само актуализируется.новый телефон именно ввел мак привязал экстеншн профиль и все. вплоть до стадиальной замены прошивки

Fedor

03.10.2017
10:24:19

в конфиге спа замена прошивки последовательная прописывается через условия в самом xml

VLAD

03.10.2017
10:27:51
в конфиге спа замена прошивки последовательная прописывается через условия в самом xml

Это не из коробки фрипбх.Речь шла за ненапряжную автоматизацию в вебморде.А так да читаешь мануал по спа и реализуешь

Fedor

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *