Genie Discord forum

Author Avataryakir12
1/18/2024, 10:17:53 AM

I've noticed that things aren't working so well when the server isn't actually connected to the world-wide-web, hear me out: The computer that is running Julia+Genie serving the app, and the single client that is viewing and interacting with the app, are both connected to the same physical router. But this router is not connected to the web (I'm in a university that restricts quite heavily what can be opened up to the world).

I'm assuming that the issues I'm seeing depend on the fact that Genie is attempting to retrieve artifacts from the web...?

Is there a way for me to have an app function in this kind of "offline mode"?

Author AvatarPere
1/18/2024, 10:36:45 AM

What sort of issues are you having? If I'm not wrong, the only things that are pulled from the internet are the genie logos, as configured in the default layout

Can you take a look at the browser' developer tools to see if there's any errors? For instance, I get this for missing assets in one of my apps

Author Avataryakir12
1/18/2024, 10:48:32 AM

Here's what it looks like (not the upload and download buttons) and the console output.

Author AvatarPere
1/18/2024, 4:29:33 PM

This totally looks like a websockets issue. Is it possible that your router is blocking ws connections?

Author Avataryakir12
1/18/2024, 4:31:25 PM

Are you running the app behind a proxy like NGINX? If so, this requires websocket-specific config No. Are you able to access the app normally from localhost? Not easily, this is served from a headless Raspberry Pi without a screen or X. If so, then it's definitely the router. I wonder how I'll be able to affect that... You could try running chromium in headless mode to test this If you mean locally on the server, then, that would be hard without a display.

Author AvatarPere
1/18/2024, 4:50:52 PM

that's why I suggested headless chromium, you can run it without a display and access its debug info at a web address

Another option is to create a MWE to check if it is indeed a websocket issue.

Give me a few mins and I'll share something

Author AvatarPere
1/18/2024, 4:58:28 PM

Here, save this snippet from the docs to a websockets.jlscript and run it with include("websockets.jl")

using Genie, Genie.Router, Genie.Assets

Genie.config.websockets_server = true # enable the websockets server

route("/") do

up() # start the servers

If you now open a browser and check the network tab in the developers tool (filter by WS), you should see something like this

Author AvatarPere
1/18/2024, 4:58:38 PM

or an error message in case the WS channel was not found

Author Avataryakir12
1/18/2024, 5:12:14 PM

Will do! Thank you. I'll report back here tomorrow...!

Author Avataryakir12
1/19/2024, 8:21:14 AM

Looks good to me. Note that I changed the up() to up(8000, "") so it'll work in my setup (RPI server connected to a router, laptop client connected to same router).

What do you suggest now? How exactly would the headless chrome thing work? I start the Genie server on the RPI, and then I use the headless mode of chromium to locally navigate to, and then see its report?

Author AvatarPere
1/19/2024, 6:15:49 PM

you run chrome from the RPI and open your local genie app. then open a browser from your computer and access chrome's debug page

chrome --headless --remote-debugging-port=8007 http://localhost:8004

Full disclosure: I haven't tested this so I'm not sure you'd be able to connect to the debugging port from another machine

Author AvatarPere
1/19/2024, 6:17:39 PM

Also, please make sure you update the packages to the latest version. There've been some changes to the channels in the last release which could solve the problem. If this doesn't work and the headless mode doesn't give any info, can you open an issue on GH with the logs and all necessary info? We'll help you out there