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

Reconnect issue #44

Open
zukrup opened this issue Nov 27, 2018 · 8 comments
Open

Reconnect issue #44

zukrup opened this issue Nov 27, 2018 · 8 comments

Comments

@zukrup
Copy link

zukrup commented Nov 27, 2018

Hi,
first of all thanks for the pod.

I am confused about connecting process.
In my experience the connection process complete successfully when it first fires "started" event then shortly after "reconnecting", and finally it fires "reconnected". and everything runs smoothly afterwards.
I watch this process in logs such as..

signalR started
signalR Reconnecting..
signalR Reconnected. Connection ID: debfd30d-862f-4e33-bed5-206a0f64a939

However,
Sometimes connection stuck on Started phase. never tries to reconnect.
When this happens I see only

signalR started
as log.
HubConnection never throws an error never disconnects (which I 'm waiting a disconnect or timeout to try to reconnect)
When I debug, HubConnection class shows as connected but proxy events cannot be called. Strangely I can call proxy methods from the application (successfully). but callbacks are failing.

Am I missing something ? or if this is a state that can happen eventually, how do I catch it?
or there is a core knowledge or feature that I must know before starting to use signalr?

many thanks.

@gbmiranda
Copy link

same..

@majum
Copy link

majum commented Dec 7, 2018

I have the same problem.

@clayellis
Copy link

I think I may be seeing the same thing

@clayellis
Copy link

@zukrup it's been a while, but were you ever able to determine why HubConnection gets stuck in started? Or rather why the callbacks were failing sometimes?

@zukrup
Copy link
Author

zukrup commented Jun 7, 2019

@zukrup it's been a while, but were you ever able to determine why HubConnection gets stuck in started? Or rather why the callbacks were failing sometimes?

Unfortunately no. I couldn't find where it stucks. However here is what i've done;

  • I put shared pref. variable on reconnect event.

  • On viewdidload event of the my base controller I configure a timer

  • and on timer event I check both connection.state == ConnectionState.connected and my variable
    sure it is very ugly but it works. I manage to reconnect in seconds if it is failing at anytime. (both on first kick or when app goes background)

@clayellis
Copy link

@zukrup Interesting. I did some debugging yesterday and found that my issue was directly related (and fixed by) #42

@santhoshappdev
Copy link

santhoshappdev commented Aug 22, 2022

not working : while let endIndex = buffer.index(of: "\n") ?? buffer.index(of: "\n\r") {
1- reconnection not working again.
Screenshot 2022-08-22 at 6 56 56 PM

2- initially got it this issue

Please help me on issue. @zukrup - (same issue I am facing now even after changes done )

@santhoshappdev
Copy link

Objective C code working in swift (using bridge header) - No reconnection issues and other. Dear @auther please check on swift version. Thank for your help

https://github.com/DyKnow/SignalR-ObjC

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

5 participants