-
Notifications
You must be signed in to change notification settings - Fork 57
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
Can't run example code in v1.6.0 #186
Comments
Hello, chelyabinsk. A surprisingly large part of Julia's ecosystem depend on HTTP.jl, so relying on older versions of it is likely to have consequences. If this is a problem we can fix, we ought to. I doubt this is a 'read the manual' issue; I get an error, too. I modified your first example to harvest error messages:
Note that we're just trying to subscribe and then close the websocket from our side. But a similar "not support byte I/O" pops up after roughly ten seconds, which may indicate this error during closing handshake's "reasonable" waiting period. Here's the output:
We can now dive into the test suite to find where it closes a wss connection, and see if that works. After all, "wss://ws.kraken.com/" might do something awry too. I need to run now, but hope you are willing to investigate more. |
Thank you for your response, it was really helpful! I managed to "fix" it by using HTTP.jl package explicitly. The following code works in Julia 1.9.0 now. using JSON, HTTP
uri = "wss://www.bitmex.com/realtime"
payload = Dict(
:op => "subscribe",
:args => "trade:XBT"
)
verbose = false
HTTP.WebSockets.open(uri; verbose, suppress_close_error=true) do ws
HTTP.send(ws, JSON.json(payload))
for msg in ws
println(msg)
end
end (@v1.9) pkg> status
Status `~/.julia/environments/v1.9/Project.toml`
[cd3eb016] HTTP v1.9.6
[682c06a0] JSON v0.21.4
[104b5d7c] WebSockets v1.6.0 I am not sure why this works, but luckily it's not a big change. |
I am having the same situation with v1.6.0. In other cases, I just get a false when trying to read the websocket
This code works returns |
Your citation is not unambiguous, but I take it that you read, without success. The message is (as it should be) empty. readguatded suppresses the actual error message. This behaviour is nice. It could perhaps be "dangerous" to try and interpret an incomplete row of bytes as a string. So check for success first, and if you have it, translate the bytes you got into a string. Readguarded is meant for stability in case you communicate over radio or similar. Details of how a connection broke are uninteresting most times. But in this case, we would like to know exactly why things fail so we can fix it. So use read instead, and throw errors all over your screen. I can recommend abbreviatedstacktraces.jl, though I have not tried it with HTTP.jl. That could alleviate the pain of reading the full and crazy long stack traces. |
The read is without success, when it shouldn't. I found that you need to specify HTTP.jl 1.5 or 1.6, and then everything works without issues. Adding WebSockets 1.6.0 adds HTTP 1.9 automatically, but I think this version is not not supported? |
Hi
This might be a "read the f-ing manual" problem, so apologies in advance. I'm using Julia 1.8.2 and I tried running the below code
When I use v1.5.9 it works fine, but with v1.6.0 I get no output.
I also tried this code
Which works in v1.5.9 but in v.1.6.0 I get the following error
ErrorException("OpenSSL.SSLStream does not support byte I/O")
I noticed that when I downgrade down to v1.5.9 HTTP library is also downgraded quite significantly. Here is the log after I run
add [email protected]
I'm happy to continue using v1.5.9, but I wonder if anyone else had the same issue. Feel free to ask any clarifying questions :)
The text was updated successfully, but these errors were encountered: