Skip to content
New issue

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

Stream end encountered #92

Closed
kevinvavelin opened this issue May 3, 2013 · 30 comments
Closed

Stream end encountered #92

kevinvavelin opened this issue May 3, 2013 · 30 comments

Comments

@kevinvavelin
Copy link

Hi there,

I see there is another thread called like mine which is closed (#82) but I've the same issue with the use of this project (https://github.com/pkyeck/socket.IO-objc).

The stream closed after a connexion with Facebook, where I send my accessToken and many data to my socket.io server and when I get my data back and do nothing else, my connexion closed.

Can you help me with ?

@Kyrynos
Copy link

Kyrynos commented Jun 2, 2014

Hello guys,

I experience this end of stream problem, immediately after the stream logs that it is connected, for no particular reason.

I am trying to create an app for my own purpose by reverse engineering method as I don't know the server environment.. but I have a working javascript code for establishing a connection from node.js. I just tried to rewrite that script into Obj-C and I couldn't find anything that might be special for that script...

All I know is that the server runs on tornado.

I also tried to implement serverID and sessionID but I don't know whether the SRWebSocket does that itself. Anyway, it didn't make any change in the result.

The log is:
[522:60b] Websocket Connected
[522:60b] WebSocket Closed
code: 0
reason: Stream end encountered
wasClean: 0

sometimes it ends with code: 1000 and wasClean: true

@Kyrynos
Copy link

Kyrynos commented Jun 2, 2014

Oh, I just found out that my implementation of SESSION is wrong.. (I just put the session string into the URL..lol..)

But still I don't know whether the SR implements it itself.. I suppose, it does not because I set up a tornado app for testing purpose and if I make a connection from browser, the path is:

/chat/008/ap6ueego/websocket

and from iPhone Simulator just:

/chat/websocket

so I assume that's why my stream ends.

Can anyone help me with this?

@Kyrynos
Copy link

Kyrynos commented Jun 2, 2014

I just figured it out so never mind guys.... sorry ^^

@sathishS6G
Copy link

Hey Kyrynos,

Could you help me to figure out the same issue which you faced??

@Kyrynos
Copy link

Kyrynos commented Aug 8, 2014

What kind of issue you are facing? Are you able to establish the connection?

To implement the session in the URL I use:
NSString *url = [NSString stringWithFormat:@"https://yourhost/its_endpoint/%i/%@/websocket", arc4random_uniform(999), [(NSString *)[[NSUUID UUID] UUIDString] lowercaseString]];

If the connection is established and then it get DCed for no reason like after sending some piece of data to it - check what are you sending.. That was the problem in my case - I was sending JSON data after establishing my connection but the server was expecting JSON data with some special prefix so that was the reason for getting cut off.

Hopefully it will help you with your issue.

@sathishS6G
Copy link

Thanks for the update.

Once, I am connected, i am sending a JSON to server, which also expecting the same, I can able to see my JSON Parameters in server too. Immediately my client is disconnected forcefully by the reason its saying, Stream and encountered.

@dfed
Copy link
Contributor

dfed commented Sep 18, 2015

Doing some housekeeping. Please reopen if still relevant

@dfed dfed closed this as completed Sep 18, 2015
@mikeKane
Copy link

Im seeing close with code 0 as well. What would cause the error code 0?

@michaelluk
Copy link

@kevinvavelin Have you figured out what's the problem? I am using the same framework(https://github.com/pkyeck/socket.IO-objc) as you did and could you give me some hints on how you solve the problem? I am getting the weird NSStreamEventEndEncountered and the websocket disconnected with error after few rounds of normal communication with my server. Thanks :)

@manish-1988
Copy link

I am getting the same error

2016-07-19 14:15:03.901 VideoCallingAppRTC[315:21955] WebSocket closed with code: 1001 reason:Stream end encountered wasClean:0 2016-07-19 14:15:03.901 VideoCallingAppRTC[315:21955] C->RS: BYE 2016-07-19 14:15:03.901 VideoCallingAppRTC[315:21955] url = https://apprtc.appspot.com/leave/gsdtest103/52754944 Disconnected! 2016-07-19 14:15:05.084 VideoCallingAppRTC[315:21955] Unregistered from room server.

@gitkong
Copy link

gitkong commented Sep 20, 2016

same problem :Closed Reason:Stream end encountered code = 1001,i dont know how to do now

@mobilestar2015
Copy link

Same problem. Stream end encountered code = 1001,.
I am getting this error while testing Kurento-iOS, it's closed while sending icecandidates to the server.
I can't figure out the reason. Please help me.

@gunjot-mansa
Copy link

gunjot-mansa commented Oct 22, 2016

I am facing the same issue "didCloseWithCode --> 1001 and reason ==> Stream end encountered", but only while using 4G connection. It works perfect with my wifi! I am also using this with kurento-ios.

@protspace
Copy link

I am facing the same issue

@gunjot-mansa
Copy link

gunjot-mansa commented Jan 13, 2017

For me, only working solution was to send ping to server after every second to sustain connection in case using 4G.

@notedit
Copy link

notedit commented Feb 9, 2017

i am faceing this problom, my python websocekt client can work well.

@Dendim0n
Copy link

Code:1001
Reason:Stream end encountered

@vysotskiyserhiy
Copy link

Code:1001
Reason:Stream end encountered

@aaelephant
Copy link

when connect Socket.io , you should append "/socket.io/?EIO=4&transport=websocket", good luck!

@aaelephant
Copy link

when connect Socket.io , you should append "ws://ip:port/socket.io/?EIO=4&transport=websocket", good luck!

@AutumnSky
Copy link

@qbshen Wow! It works to me! Thank you. BTW, Where this option from? and What does this option doing for Connection? Please give me any hint.

@jose920405
Copy link

@qbshen

My error was

Code:1001
Reason:Stream end encountered

Using /socket.io/?EIO=4&transport=websocket

My logs

onopen >>>>>>>
'onmessage', '0{"sid":"WAKpVjnwpgUSuz8OAAAD","upgrades":[],"pingInterval":25000,"pingTimeout":60000}'
'onmessage', '40'
'onclose ==> ', 1005, null

@Piasy
Copy link

Piasy commented Aug 26, 2018

I faced the same issue today, and I figured out that it was because I didn't specify sub protocols, which caused server closing the connection.

@AlphaJian
Copy link

@Piasy I met the same issue. Could you please tell me which sub protocols do you specify?

@Piasy
Copy link

Piasy commented Aug 28, 2018

I was connecting to Janus Gateway's via websocket, it need set janus-protocol as sub protocol.

@Passssgai
Copy link

俺也一样

@Passssgai
Copy link

俺也一样的问题,拼接了也不好使。有没有其他的解决办法

@tshradheya
Copy link

Any help on this? Not using sockeet io. Using react native websockets

@yigegongjiang
Copy link

Me too : (

@maxhawkins
Copy link

I solved this issue by sending a keepalive ping every once in a while.

My WebSocket connection was proxied through nginx which times out the WebSocket after 60 seconds without receiving a message.

From React Native:

setInterval(() => ws.ping(), 30000);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests