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

mux minimal slider examples doesn't work #419

Open
freemin7 opened this issue Jan 3, 2024 · 1 comment
Open

mux minimal slider examples doesn't work #419

freemin7 opened this issue Jan 3, 2024 · 1 comment

Comments

@freemin7
Copy link

freemin7 commented Jan 3, 2024

(MuxInteract) pkg> st
Status `~/MuxInteract/Project.toml`
  [5ae59095] Colors v0.12.10
  [c601a237] Interact v0.10.5
  [a975b10e] Mux v1.0.1
  [0f1e0344] WebIO v0.8.21
 using Interact, Mux, WebIO

 s = slider(1:100);

function app(req) # req is a Mux request dictionary
  println(req); return s
end

webio_serve(page("/", app), 8000)

Upon loading the website i get this in the REPL:

Dict{Any, Any}(:query => "", :method => "GET", :params => Dict{Any, Any}(), :path => SubString{String}[], :cookies => HTTP.Cookies.Cookie[HTTP.Cookies.Cookie("secret", "QeJ7ec6w", "", "", Dates.DateTime("0001-01-01T00:00:00"), "", Dates.DateTime("0001-01-01T00:00:00"), Dates.DateTime("0001-01-01T00:00:00"), 0, false, false, false, false, HTTP.Cookies.SameSiteDefaultMode, "secret=QeJ7ec6w", String[])], :uri => URI("/"), :data => UInt8[], :headers => Pair{SubString{String}, SubString{String}}["Host" => "localhost:8000", "User-Agent" => "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0", "Accept" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8", "Accept-Language" => "en-US,en;q=0.5", "Accept-Encoding" => "gzip, deflate, br", "Connection" => "keep-alive", "Cookie" => "secret=QeJ7ec6w", "Upgrade-Insecure-Requests" => "1", "Sec-Fetch-Dest" => "document", "Sec-Fetch-Mode" => "navigate", "Sec-Fetch-Site" => "none", "Sec-Fetch-User" => "?1"])
Error handling websocket connection:
TaskFailedException
Stacktrace:
  [1] wait
    @ ./task.jl:349 [inlined]
  [2] create_socket(req::Dict{Any, Any})
    @ WebIO ~/.julia/packages/WebIO/8Xm9p/src/providers/mux.jl:47
  [3] (::Mux.var"#5#6"{Mux.var"#29#30"{Vector{SubString{String}}}, typeof(WebIO.create_socket)})(f::Function, x::Dict{Any, Any})
    @ Mux ~/.julia/packages/Mux/PipQ9/src/Mux.jl:17
  [4] (::Mux.var"#1#2"{Mux.var"#5#6"{Mux.var"#29#30"{Vector{SubString{String}}}, typeof(WebIO.create_socket)}, Mux.var"#1#2"{typeof(Mux.wclose), Mux.var"#1#2"{Mux.var"#19#20"{Mux.var"#23#24"{Symbol, Int64}}, Mux.var"#21#22"{String}}}})(x::Dict{Any, Any})
    @ Mux ~/.julia/packages/Mux/PipQ9/src/Mux.jl:10
  [5] splitquery(app::Mux.var"#1#2"{Mux.var"#5#6"{Mux.var"#29#30"{Vector{SubString{String}}}, typeof(WebIO.create_socket)}, Mux.var"#1#2"{typeof(Mux.wclose), Mux.var"#1#2"{Mux.var"#19#20"{Mux.var"#23#24"{Symbol, Int64}}, Mux.var"#21#22"{String}}}}, req::Dict{Any, Any})
    @ Mux ~/.julia/packages/Mux/PipQ9/src/basics.jl:31
  [6] #1
    @ ~/.julia/packages/Mux/PipQ9/src/Mux.jl:10 [inlined]
  [7] wcatch(app::Mux.var"#1#2"{typeof(Mux.splitquery), Mux.var"#1#2"{Mux.var"#5#6"{Mux.var"#29#30"{Vector{SubString{String}}}, typeof(WebIO.create_socket)}, Mux.var"#1#2"{typeof(Mux.wclose), Mux.var"#1#2"{Mux.var"#19#20"{Mux.var"#23#24"{Symbol, Int64}}, Mux.var"#21#22"{String}}}}}, req::Dict{Any, Any})
    @ Mux ~/.julia/packages/Mux/PipQ9/src/websockets_integration.jl:11
  [8] #1
    @ ~/.julia/packages/Mux/PipQ9/src/Mux.jl:10 [inlined]
  [9] todict
    @ ~/.julia/packages/Mux/PipQ9/src/basics.jl:25 [inlined]
 [10] #3 (repeats 2 times)
    @ ~/.julia/packages/Mux/PipQ9/src/Mux.jl:14 [inlined]
 [11] (::Mux.var"#1#2"{Mux.var"#3#4"{Mux.var"#3#4"{typeof(Mux.todict), typeof(Mux.wcatch)}, typeof(Mux.splitquery)}, Mux.var"#1#2"{Mux.var"#5#6"{Mux.var"#29#30"{Vector{SubString{String}}}, typeof(WebIO.create_socket)}, Mux.var"#1#2"{typeof(Mux.wclose), Mux.var"#1#2"{Mux.var"#19#20"{Mux.var"#23#24"{Symbol, Int64}}, Mux.var"#21#22"{String}}}}})(x::HTTP.WebSockets.WebSocket)
    @ Mux ~/.julia/packages/Mux/PipQ9/src/Mux.jl:10
 [12] (::Mux.var"#9#10"{Mux.App})(sock::HTTP.WebSockets.WebSocket)
    @ Mux ~/.julia/packages/Mux/PipQ9/src/server.jl:48
 [13] upgrade(f::Mux.var"#9#10"{Mux.App}, http::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.Connections.Connection{Sockets.TCPSocket}}; suppress_close_error::Bool, maxframesize::Int64, maxfragmentation::Int64, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ HTTP.WebSockets ~/.julia/packages/HTTP/bDoga/src/WebSockets.jl:440
 [14] upgrade
    @ ~/.julia/packages/HTTP/bDoga/src/WebSockets.jl:420 [inlined]
 [15] (::Mux.var"#14#15"{Mux.App, Mux.App})(http::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.Connections.Connection{Sockets.TCPSocket}})
    @ Mux ~/.julia/packages/Mux/PipQ9/src/server.jl:81
 [16] #invokelatest#2
    @ ./essentials.jl:819 [inlined]
 [17] invokelatest
    @ ./essentials.jl:816 [inlined]
 [18] handle_connection(f::Function, c::HTTP.Connections.Connection{Sockets.TCPSocket}, listener::HTTP.Servers.Listener{Nothing, Sockets.TCPServer}, readtimeout::Int64, access_log::Nothing)
    @ HTTP.Servers ~/.julia/packages/HTTP/bDoga/src/Servers.jl:450
 [19] macro expansion
    @ ~/.julia/packages/HTTP/bDoga/src/Servers.jl:386 [inlined]
 [20] (::HTTP.Servers.var"#16#17"{Mux.var"#14#15"{Mux.App, Mux.App}, HTTP.Servers.Listener{Nothing, Sockets.TCPServer}, Set{HTTP.Connections.Connection}, Int64, Nothing, Base.Semaphore, HTTP.Connections.Connection{Sockets.TCPSocket}})()
    @ HTTP.Servers ./task.jl:514

    nested task error: MethodError: no method matching isopen(::HTTP.WebSockets.WebSocket)
    
    Closest candidates are:
      isopen(::Union{Base.DevNull, Core.CoreSTDERR, Core.CoreSTDOUT})
       @ Base coreio.jl:24
      isopen(::Union{Base.AsyncCondition, Timer})
       @ Base asyncevent.jl:160
      isopen(::Channel)
       @ Base channels.jl:214
      ...
    
    Stacktrace:
     [1] (::WebIO.var"#98#99"{WebIO.WebSockConnection, HTTP.WebSockets.WebSocket})()
       @ WebIO ./task.jl:514

and s[] isn't updated.

@freemin7 freemin7 changed the title mux minimal slider examples doesn mux minimal slider examples doesn't work Jan 3, 2024
@Benoit9
Copy link

Benoit9 commented Jan 7, 2024

I have the same issue, and I believe it is also documented in the WebIO project:

JuliaGizmos/WebIO.jl#513

The "fix" is to downgrade WebSockets to version 1.5.9, which in turn downgrades Mux, HTTP, etc., so not a great solution.

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

2 participants