Replies: 5 comments
-
@hulkingshtick thx for response, my code assumes it's the same as in the chat example. |
Beta Was this translation helpful? Give feedback.
-
@garyburd @hulkingshtick thx, just re-read what you wrote, so you're saying ReadJSON will return err itself without client sending anything? It's just the comment explaining the function says otherwise ("all future reads will return an error"), that why I'm confused I guess:
based on the comment, in case someone's phone battery dies or client network doesn't send a websocket close(), then ReadJSON won't return |
Beta Was this translation helpful? Give feedback.
-
@garyburd @hulkingshtick would appreciate if you could confirm this "in case someone's phone battery dies or client network doesn't send a websocket close(), then ReadJSON won't return err at all even after ReadDeadline bcz a read never came through" |
Beta Was this translation helpful? Give feedback.
-
@garyburd @hulkingshtick I think I found the code in
which means indeed like you said, ReadJSON will return err after
So maybe making ReadJSON comment more clear about err being returned after |
Beta Was this translation helpful? Give feedback.
-
@hulkingshtick ahh see it's an internal go pkg doing the work, then chat example takes my concern into account... Thx for clarifying that |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there an existing issue for this?
Current Behavior
I used chat example to modify some code, added clients map and send chan. The example makes sense that after pongWait the next reads return err and cause defer to be called thus calling
c.hub.unregister <- c
. Happy days.Expected Behavior
Let's say app user exits, and pong never comes back (thus no next read)... that means the socket is still opened (kind of blocked now but still open)? That socket/connection should be deleted for good after ReadDeadline, it's not. How can I make defer work (that will call
c.hub.unregister <- c
) after pongWait without waiting for the next read which might not happen. I might have missed something obvious in the code or should have another goroutine checking clients and if they have expired and remove manually? Thanks. Hopefully this will help other developers who are a little confused.@garyburd
Steps To Reproduce
No response
Anything else?
No response
Beta Was this translation helpful? Give feedback.
All reactions