-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add new APIs and example #58
Conversation
Okay, good PR, but there are some problems with the code. Can you let me modify it directly on your PR? |
p.s., I'll have to update this after your comments; does that mean that I should have created this as a "draft" PR? |
I will update all the latest newly added APIs soon |
Your comment appeared after I submitted mine. Lol. Sure. How do I give you permission? |
Haha, actually you gave me permission |
Any time I submit a PR, just tell me what changes you want and I'll take care of it. I can do more after work tomorrow. Thanks. |
Also, if it's easy to a build step to copy all example .exe and supporting files (e.g., html) into their own subfolder -- it would be a good pattern across all |
I think I should have fixed it, just use But I'm not sure whether the running effect is what you need. You still need to confirm it. |
Thank you. I guess I didn't need to write all that copy files code! I'm learning. I'll keep future PRs clean of that kind of stuff, or mark them as drafts. |
Add APIs:
|
I have to get to sleep; I'll check back tomorrow. |
@jinzhongjia would you like me to work on the spa/free_port example above? Just let me know if you want me to do anything. I don't want to spend time on it if you're doing it. Thanks. |
so, you think this pr now is ok? |
Do you mean the whole PR (surfacing getFreePort, the stuff you added, my example app)? Or just the new API stuff. Can you selectively merge, or is it all-or-nothing? I'm not familiar with git workflow when 2 people have worked on a single pull request. Before it's merged, I need to remove that copy file junk that I put in Sorry I don't know more git. I've worked alone most of the time. |
When two people handle a pull request, it can be regarded as two people using a branch together. You only need to pull regularly. You only need to delete and then push. |
Ok. I'll pull to get your edits. Then I'll clean up my stuff. Then push. |
I removed my commented-out code in However, there may still be a problem that will show up again. It's not a problem with this PR, I don't think. The problem: Yesterday, @hassandraga fixed the missing events not being delivered to the handler (click, navigation) , which caused navigation to trigger a disconnect, which he then fixed. I pulled his changes, and at first it did not seemed fixed; so I cleaned zig-cache and zig-out and tried again, and still not fixed. Then I came back an hour later and ran it and it was fixed. And my own app (a SvelteKit SPA) is working fine like that. Now, navigation seems to be again causing disconnect. E.g., in Anyway, try to run the Problems that come and go, in a multi-threaded system, make me worry. But I could not be paying attention closely enough to what I'm doing. |
I did not see that issue in C. Probably it's the wrapper, or how the wrapper is interacting with the C library. |
I can't work on it tomorrow, but Saturday I'll try to debug it. First, I'll see if it happens with other wrappers. Then I'll build webui in debug mode and see what I can figure out. I'd like to gain a deeper understanding of webui's internals, anyway. |
Sounds good @sensiblearts. You can also try to disable the multi-threading to see if this improve the UX. |
@jinzhongjia it looks fixed. I think you can merge and then I'll pull and see if the problem is gone on my machine. |
@jinzhongjia @hassandraga I just pulled this newly merged PR, just after the
I'll dig into it tomorrow. |
aha,I do not have machine with windows,maybe I can not help more 😞 |
Thank you @sensiblearts for the report. I'm working on it. |
std.debug.print("URL: {s}\n", .{url});
std.debug.print("LEN: {d}\n", .{len});
// we generate the new url!
const new_url = allocator.allocSentinel(u8, len, 0) catch unreachable; Logs:
As far I can tell, WebUI gives the correct pointer all the time, but copying the However, the wrapper should convert the C |
em... |
This causes disconnect and crash, too, suggesting that it's the
@hassandraga forgive my memory, but after I run UPDATE: It does the same thing in the |
If we are talking about the C then just run If we are talking about Zig, I really don't know how to properly doing it. I don't maintain the Zig wrapper. @jinzhongjia is the best person to ask. |
Thank you for the report @sensiblearts. to be honest, I completely forgot to test the release mode, I only test the debug one. Let me check this. |
Ok,thanks. Is there a way to printf in release mode? What if webui had a C |
the new commit of webui seems fix this problem |
@jinzhongjia do you mean it's fixed on Windows? |
I didn't test with windows, but I found that |
This PR surfaces
webui.get_free_port()
, from the latest build.And to test it, a new
example
called,custom_spa_server_on_free_port
.Why this example?
I'm doing something like this with SvelteKit, so I built an example to test the approach. Use it or not, or alter it as you see fit.
Question: Is there something about my example that is causing click and navigation events to be dropped?
(This example does not need those events -- only EVENT_CONNECTED and EVENT_DISCONNECTED, which are working fine -- but I need to figure out whether it's my code or an API change or a break.)
Thanks.