Skip to content

How to close a server while using Webview #10749

@wwderw

Description

@wwderw

I've tried this with server in the std, as well as, the ABC server servicing static files.

Currently using webview 0.5.6 and Deno 1.8.3 (as neither the latest stable or canary have been successful using the latest of any of the modules with Deno.

Basically, I'm just bootstrapping an app that mainly uses a GO wasm for the logic.

I can get everything running, but when I close the webview, it hangs and then the OS gives me a msg to terminate.

I know typically we want http servers to run indefinitely, but since this is mainly app like, I want the server to close when the webview window closes, but gracefully. If that is possible. If it is not possible, is there anyway to disable CORs in Deno to where it isn't necessary to have to worry about a server?

I haven't been able to find too much on trying to close a server using webview and deno, but this is what I have come up with initially:

webview.run(({event}) => { switch (event){ case 'close': Deno.exit(); break; case 'domContentLoaded': console.log('Program Ready!'); break; }; });

Now, it was suggest for me to use webview.drop() in the webview_deno issue section, instead of Deno.exit(), but instead of hanging the app for a time with no response, it went right to giving me the OS msg.

I noticed that I don't get either case, so I'm sure that is has something to do with my logic, but I haven't found anything on there about programmatically closing a server, doesn't matter if I'm using webview or the default browser. So I don't know if it's really possible, if it isn't possible (while I would prefer the control that I get for the window in webview, I would use the browser if it gave me that ability and that was the only way to get it), I thought I would ask about programmatically stopping CORs from being in effect without a server (it doesn't make outside internet calls, so my concern there is not as high).

Thoughts or am I out in la-la land with thinking of doing such a thing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions