I needed to do many months ago a small web application with a form and websockets (to avoid the reload of the page).
function show_page() form = read("public/form.html") |> String # existing HTML page return Assets.channels_support() * form # combining with channel support end
Do you have any suggestions on how to connect a WebSocket to an MVC web app @essenciary?
<% Genie.Assets.channels_support() %> inside the HTML of your web page and this outputs a
<script>...</script> tag and sets up routing and everything else.
This in effect, in the browser, gives you access to a
Genie.WebChannels object and you can call
Genie.WebChannels.sendMessageTo(...) to push data over the websocket.
On the server, you define the corresponding
channel(...) to catch/route/delegate these websockets requests to your handler functions.
Thank you very much for your answer, that worked for me!
Related github issue here: Websocket Documentation Missing Website Integration · Issue #552 · GenieFramework/Genie.jl · GitHub
Happy to hear it!