Hello,
I am developing the CurricularAnalytics toolbox and I am using Blink for terminal usage and WebIO scope for IJulia. It works fine at my local machine. But when create a server running Jupyter notebook it doesn’t show the visualization.
I am adding the way I create server on localhost and call it but it is open source so you can open this link to see the actual codes.
const LOCAL_EMBED_PORT = 8156
const LOCAL_EMBED_FOLDER = joinpath(dirname(pathof(CurricularAnalytics)),"..","embed_client","dist")
function get_embed_url()
local_embed_url = string("http://localhost:", LOCAL_EMBED_PORT)
try
HTTP.request("GET", local_embed_url)
catch
serve_local_embed_client()
end
return local_embed_url
end
function serve_local_embed_client()
@async HTTP.serve(HTTP.Sockets.localhost, LOCAL_EMBED_PORT) do req::HTTP.Request
# default render index.html case
req.target == "/" && return HTTP.Response(200, read(joinpath(LOCAL_EMBED_FOLDER, "index.html")))
# construct file location from request target
file = joinpath(LOCAL_EMBED_FOLDER, HTTP.unescapeuri(req.target[2:end]))
# determine / set content type
content_type = "text/html"
if (occursin(r".js$", file))
content_type = "application/javascript"
elseif (occursin(r".css$", file))
content_type = "text/css"
end
Messages.setheader(req, "Content-Type" => content_type)
# return file or 404 if not present
return isfile(file) ? HTTP.Response(200, read(file)) : HTTP.Response(404)
end
end
Any idea or help will be appreciated.
The error I am getting is " localhost refused to connect."