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

When Send is called on a closed WebSocket, no error returned. #7

Open
dmitshur opened this issue Jan 26, 2015 · 3 comments
Open

When Send is called on a closed WebSocket, no error returned. #7

dmitshur opened this issue Jan 26, 2015 · 3 comments
Labels

Comments

@dmitshur
Copy link
Member

The problem is already mentioned in code, see wrapper.go#L97-L98.

I can confirm the issue. Send returns nil error, but there is a WebSocket is already in CLOSING or CLOSED state. error in the console.

image

Any ideas on how we can fix this?

@dmitshur dmitshur added the bug label Jan 26, 2015
@dmitshur dmitshur changed the title When WebSocket.Send is called on a closed WebSocket, no error returned. When Send is called on a closed WebSocket, no error returned. Jan 26, 2015
@dmitshur
Copy link
Member Author

Just a dumb idea, but can we check the ReadyState value in Send?

@mjohnson9
Copy link
Member

Just a dumb idea, but can we check the ReadyState value in Send?

I don't see any technical reason that we couldn't. I wonder if there's a way that we could capture the exception and return it, though.

@dmitshur
Copy link
Member Author

I wonder if there's a way that we could capture the exception and return it, though.

I agree that would be better. It's clean, correct, consistent, and doesn't incur an extra performance penalty every time sending on an open socket. I would only fall back to checking ReadyState as a backup, if we can't get anything else to work.

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

No branches or pull requests

2 participants