Skip to content

Commit 773062b

Browse files
SimonDanischshashi
authored andcommitted
allow for routing callback
1 parent 74baf30 commit 773062b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/providers/generic_http.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using WebSockets, Sockets
2-
import HTTP, AssetRegistry, JSON
1+
using Sockets
2+
import AssetRegistry, JSON
33
using WebSockets: is_upgrade, upgrade
44

55
struct WSConnection{T} <: WebIO.AbstractConnection
@@ -67,6 +67,8 @@ kill!(server::WebIOServer) = put!(server.server.in, HTTP.Servers.KILL)
6767

6868
const singleton_instance = Ref{WebIOServer}()
6969

70+
const routing_callback = Ref{Any}((req)-> missing)
71+
7072
"""
7173
WebIOServer(
7274
default_response::Function = ()-> "";
@@ -193,7 +195,7 @@ provider dependencies.
193195
function Base.show(io::IO, ::MIME"application/webio", app::Union{Scope, Node})
194196
# Make sure we run a server
195197
c = global_server_config()
196-
WebIOServer(baseurl = c.url, http_port = c.http_port)
198+
WebIOServer(routing_callback[], baseurl = c.url, http_port = c.http_port)
197199

198200
webio_script = wio_asseturl("/webio/dist/bundle.js")
199201
ws_script = wio_asseturl("/providers/websocket_connection.js")

0 commit comments

Comments
 (0)