Genie.jl
Genie.jl copied to clipboard
Websocket Documentation Missing Website Integration
In the web socket documentation found here https://genieframework.github.io/Genie.jl/dev/tutorials/17--Working_with_Web_Sockets.html, there are no examples of web sockets being implemented with any other html. They are only implemented on their own with the response from the Assets.channels_support() function. Thus it is very unclear to me how I can include this in a Genie website that contains html. I started a discourse here as well https://discourse.julialang.org/t/how-to-add-websocket-to-genie-site/84976.
@essenciary I was hoping you could help me figure out how to add a websocket to an MVC app. I have read the entire genie.jl documentation and still cannot figure it out. Please let me know how this can be done.
You put <% 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.
We could include a simple client - server example using web pages in the docs.
Thank you very much for your answer, that worked for me!
That info should definitely be included in the docs. It would be very helpful.