Comments (5)
Hi @macroscian 👋
Good timing. It's been a while since I looked at this, but coincidentally, I was just updating some stuff.
Yeah. The issue is that HTTP v0.8 was quite a change from v0.7. I'll try to push something to master
soon and see if that helps you 🙏
Edit: Pushed 😊
from pages.jl.
The version I just pushed to master
is a bit of change too 😅🙏
One thing I liked about this package was the ability to change routes on the fly even when the server is running. When I switched to using HTTP.Router
(mostly because it has support for variable / parametric routes, I lost that ability.
Now, I am moving back to my original router, which, for the time being, means variable / parametric routes will not work. Were you relying on that?
I'd like to add parametric routes back at some point. If you need them, I could make it a priority.
from pages.jl.
I haven't updated the docs yet, but there are no Get
or Post
methods anymore.
If you want a POST
, it is now like this:
Endpoint("/post/endpoint",POST) do request::HTTP.Request
# process the `POST`
end
The default method is GET
, so if you just want a normal GET
method, it is still:
Endpoint("/get/endpoint") do request::HTTP.Request
# process the `GET`
end
Please let me know if you have any problems.
I want to tag a version, but I still need to test the WebSocket
stuff. The way I like to test WebSockets
is with PlotlyJS
, but PlotlyJS
has a dependency on WebSockets.jl and WebSockets.jl doesn't work for HTTP v0.8, so I'm currently trying to fix THAT so I can test my websocket stuff 😅
from pages.jl.
That's brilliant as ever, thanks Eric. Serving the files now works great, but I did notice something odd about websockets. I've put the Julia error log below - it tracks back to a loop in julia that updates a javascript progress bar thus:
Pages.message("/uv_damage", client_id, "script", "progress(\"$scen\",\"$i\")")
It runs fine for a while, and then the browser reports an ERR_EMPTY_RESPONSE, though I don't think I'm sending an empty response, as the scen
and i
variables are always set. I'll double check it's not something stupid I've done, and temporarily remove the progress bar to check things run through without it.
Personally, I don't use parametric routing, so don't prioritise it (or anything else!) on my behalf. -Thx.
Error: error handling request
│ exception =
│ ArgumentError: stream is closed or unusable
│ Stacktrace:
│ [1] check_open at ./stream.jl:256 [inlined]
│ [2] uv_write_async(::Sockets.TCPSocket, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:804
│ [3] uv_write(::Sockets.TCPSocket, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:778
│ [4] unsafe_write(::Sockets.TCPSocket, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:834
│ [5] unsafe_write at /root/.julia/packages/HTTP/GN0Te/src/ConnectionPool.jl:132 [inlined]
│ [6] unsafe_write at ./io.jl:509 [inlined]
│ [7] macro expansion at ./gcutils.jl:87 [inlined]
│ [8] write at ./io.jl:532 [inlined]
│ [9] wswrite(::HTTP.WebSockets.WebSocket{HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}, ::UInt8, ::Array{UInt8,1}) at /root/.julia/packages/HTTP/GN0Te/src/WebSockets.jl:201
│ [10] wswrite at /root/.julia/packages/HTTP/GN0Te/src/WebSockets.jl:183 [inlined]
│ [11] unsafe_write at /root/.julia/packages/HTTP/GN0Te/src/WebSockets.jl:153 [inlined]
│ [12] macro expansion at ./gcutils.jl:87 [inlined]
│ [13] write(::HTTP.WebSockets.WebSocket{HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}, ::String) at ./strings/io.jl:164
│ [14] message(::String, ::Dict{String,String}) at /root/.julia/packages/Pages/cPMFY/src/api.jl:47
│ [15] message(::String, ::String, ::String, ::String) at /root/.julia/packages/Pages/cPMFY/src/api.jl:51
│ [16] #main#51(::String, ::Function, ::Array{Dict{String,Any},1}, ::Array{Dict{String,Any},1}, ::Dict{String,Any}) at /root/.julia/packages/uv_damage/dY97m/src/uv_damage.jl:150
from pages.jl.
Oh man! Was afraid there could be some problems with websockets. I'm squashing 10s of issues on WebSockets.jl trying to upgrade it to HTTP v0.8 and then I'll be able to dig in and try to see what is going on.
Your issues sounds like it might be HTTP related. You might check to see if there is a relevant outstanding issue there until I can have a look.
from pages.jl.
Related Issues (19)
- Is the latest version of this being pulled with: Pkg.add("Pages") ? HOT 2
- how to handle routing without specifying every file? HOT 5
- how to get "post" method data in endpoint? HOT 4
- Update charts in real-time as computation happens
- A crash from latest master branch HOT 1
- Create a CORS example HOT 6
- POST, PUT and DELETE methods? HOT 3
- Support routing variables and query parameters HOT 7
- Allow for more flexible routing
- A small correction HOT 3
- Websocket help HOT 4
- Error when hitting "back"
- Case sensitive routes
- Clean interruption HOT 3
- JSCall
- Fix `warn()` function for Julia v1.0+
- Add an example for using websockets HOT 4
- UndefVarError: `closewrite` not defined
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pages.jl.