-
Notifications
You must be signed in to change notification settings - Fork 306
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
NetConn adapter #100
Comments
Maybe not net.Conn but at least io.ReadWriteCloser as SetDeadline won't work as expected as described in #80. But at that point, it seems not nearly as useful. 🤔 |
I think net.Conn is fine with the documented limitation. It's unfortunate but will work fine for 99% of use cases. |
I just ran into this while trying to use |
sg. Out of curiosity, why use |
@jancona could you test the latest master to ensure it works properly with your code? |
It seems like every Read() by the client terminates with an EOF. Is that expected behavior? (I'm not a websockets expert.) In any case, that causes problems for You asked earlier about my use case for |
Definitely not. It's a bug, will fix, thank you for testing.
Seems reasonable to me. |
Thanks again for testing. I believe I fixed the bug + added a test, please try again @jancona. |
That fixes it--thanks! Will you be tagging a new release? |
Yup, tagging it now. |
Thanks for implementing this, @nhooyr, it's really handy & appreciated here :) |
I'm stumped on an issue using the NetConn adapter. I have the below for communicating via a websocket to a remote docker instance using Docker's Go SDK (
On the receiving end I accept the request and relay to the Docker socket:
It works great out the box, brilliant feature, with one exception. When trying to connect to attach to a container, the Docker API hijacks the connection and for some reason this seems to stump the NetConn:
Error message:
The error varies on each request
I'm stumped on this one, any ideas would be welcome. The error message are coming from the Docker client, not the websockets, but for some reason the websocket is modifying the response. When connecting directly to the UNIX socket implementation it works ok. |
It seems like it does work ok, but only if it is the first request. If I call I am exploring Docker side as well of course, very possible this has nothing to do with the websocket. EDIT: Managed to narrow it down to: https://github.com/moby/moby/blob/311b9ff0aa93aa55880e1e5f8871c4fb69583426/client/hijack.go#L86C1-L86C1 Hard to understand why it would conflict with the websocket connection only on second requests. |
Hmm not sure, but can you open a new issue @maggie44 |
@nhooyr thanks for making this wrapper, it's working excellently for me so far. I'm trying to make sure I understand the caveats. It should only be an issue in a situation where some code expects to be able to use Is that basically right? |
I don't remember if I do plan on upgrading it to use the Deadline methods on the underlying connection someday but I don't have an ETA. |
Sounds good, thanks! |
Was going through some random reading and I noticed this is an issue that appeared multiple times on the gorilla/websocket tracker:
People using nhooyr/websocket also have ran into this: #80
With my solution in #87, this is relatively simple to implement.
I'm thinking
websocket.NetConn(c *websocket.Conn) net.Conn
The text was updated successfully, but these errors were encountered: