Ok, turns out I *can* actually replace the http response generating code, 
as long as is a function (I tested it using a static response string...).

using Autoreload

arequire("main.jl") # server code to be reloaded

function reloadloop()
while true
areload()
sleep(3)
end
end
@async reloadloop()
start( app, 8000 ) # start morsel app


Now I can run the server on the command line 
julia runserver.jl

And stop it with ctrl+c. Probably not the best way to go about it, but 
seems to do its job for now.

keskiviikko, 15. lokakuuta 2014 12.02.39 UTC+3 Antti Halla kirjoitti:
>
> Hi,
>
> I'm using HttpServer.jl to process requests. How can I reload the code I 
> use to generate the response? 
>
> Calling: 
>
> run(server, 8000)
>
> in the repl blocks. I can send ctrl+c to interrupt it, but only before the 
> first request is handled. After that I'm unable to send it the ctrl+c 
> signal. (I have to use 'kill' for the julia-process on the command line)
>
> I could use @async to avoid the blocking but I don't find a way to 
> terminate the task externally (and to free the socket). 
>
> Cheers,
> Antti
>

Reply via email to