World: r3wp
[!Cheyenne] Discussions about the Cheyenne Web Server
older newer | first last |
Dockimbel 29-Nov-2011 [11001x3] | I don't understand what you mean by "external" there? |
websocket test server application : you already have it, just run cheyenne.exe and start writing your websocket app. | |
Btw, the embedded mode is for providing an HTTP server to an existing app, not a full-featured Cheyenne. If you want to make a GUI app in View for just a few simple interaction with Cheyenne, you can just #include your View code in %cheyenne.r. | |
Endo 29-Nov-2011 [11004] | I don't understand what you mean by external" there?" when I copy embed-demo.exe alone to outside cheyenne directory, it gives an error like "cannot find the file mods/mod-embed.r". So even encapped it requires that file and probably the other modules (.r) files. What I was thinking, when I use embed mode and encap the cheyenne, it already includes necessary mod files into encapped exe. |
Dockimbel 29-Nov-2011 [11005] | Strange, all the dependent files should be encapped in the executable. Testing locally... |
Endo 29-Nov-2011 [11006] | Here is the error: make object! [ code: 500 type: 'access id: 'cannot-open arg1: "/C/Documents and Settings/endo/mods/mod-embed.r" arg2: none arg3: none near: [do any [get-cache file file]] where: 'do-cache ] |
Dockimbel 29-Nov-2011 [11007] | Ok, I can reproduce it. The module is missing from the Cheyenne package list in %cheyenne.r |
Endo 29-Nov-2011 [11008] | I see, so its only for mod-embed.r not for other mods I think. |
Dockimbel 29-Nov-2011 [11009x2] | It was left out because I never tested encapping in embedded mode. |
I pushed a fix in the repo. | |
Endo 29-Nov-2011 [11011] | Ok, great. Let me test.. |
Dockimbel 29-Nov-2011 [11012x2] | Do not forget to run Cheyenne once after update your files to refresh the cache.efs file. |
update => updating | |
Endo 29-Nov-2011 [11014x2] | Sure |
Works great. Thank you! the embedded mode is for providing an HTTP server to an existing app, not a full-featured Cheyenne But I can use RSP, websockets and webapps I think, right? | |
Dockimbel 29-Nov-2011 [11016x2] | No, they are all disabled in embedded mode. From "Notes" header in %embed-demo.r: All the other modules will be disabled while mod-embed is active (current behaviour, it may change in the future). |
If you want a full-featured Cheyenne and integrate your own GUI app, you would have to make it the other way around, which is include your app in %cheyenne.r. | |
Endo 29-Nov-2011 [11018x3] | Oh but there a "testapp" in embed-demo.r? and its not plain HTML. |
Is it not RSP? | |
I mean its included in the application but still runs in RSP engine? | |
Dockimbel 29-Nov-2011 [11021x2] | No, it's the embed API, see 'publish-site and 'testapp specs in %embed-demo.r |
As the (long) note explains it, it's a special API for closely integrating Cheyenne HTTP server with an existing app. | |
Endo 29-Nov-2011 [11023] | Ok, now I got it. Thanks a lot. |
Dockimbel 29-Nov-2011 [11024] | You're welcome. |
Endo 9-Dec-2011 [11025] | Doc: When I use jobs section in httpd.cfg, the jobs are executed in Cheyenne or UniServe process or it uses Task Master? I mean the jobs can block Cheyenne or not? |
Dockimbel 9-Dec-2011 [11026x3] | It depends on the type of the "action" part of the job rule. Here's what does the scheduler by default (UniServe/libs/scheduler.r): url! [read action] block! [do action] file! [launch action] function! [do :action] word! [do get :action] |
(I remember having issues with LAUNCH, let me know if it works for you) | |
To answer your question, if the type of action is file!, it should not block Cheyenne, others will block. It should be possible to make the url! action not block by using an async HTTP query instead of READ (just adding the HTTP async client for UniServe should work). | |
Endo 9-Dec-2011 [11029x2] | hmm, there is no CALL option? |
oh sorry :) use CALL in a function :) | |
Dockimbel 9-Dec-2011 [11031x2] | LAUNCH %script = CALL on REBOL executable passing the script as argument. |
Yes, you can also use CALL in a function if you prefer. | |
Endo 9-Dec-2011 [11033x3] | Ok, I'm testing LAUNCH.. |
Wow something weird happened.. jobs [every 5 s do %test.r] --> creates a new cheyenne process every 5 seconds %test.r --> REBOL [] print now | |
jobs [every 5 s do [launch %test.r]] does same. | |
Dockimbel 9-Dec-2011 [11036x2] | If you're using the encapped version, LAUNCH will just instanciate the Cheyenne binary. |
CALL is a better option I guess. | |
Endo 9-Dec-2011 [11038] | Can I use Task Master from jobs, if I added my module to UniServe? something like: jobs [every 5 s do [shared/do-task [...] ] ] |
Dockimbel 9-Dec-2011 [11039x3] | I think you can (if you know how to build a "handler" for Task-master). |
You might have to use a longer access path like: uniserve/shared/do-task | |
You could also use an async HTTP query on an RSP script instead. | |
Endo 9-Dec-2011 [11042x3] | Thank you. I'll try. What I'm working on is, to poll a database table and send some changes to a client on a web socket. polling should not block Cheyenne of course. |
You could also use an async HTTP query on an RSP script instead. This might do the job. | |
My plan is, adding database to Cheyenne config, poll in an aysnc way (jobs, task-master, etc.) and send something to clients over web socket. | |
Dockimbel 9-Dec-2011 [11045x3] | Web socket + database query: it won't block if you transfer the query job to an RSP script. See the ws demo app: %www/ws-app/ws-test-app.r and the back-end RSP script: %www/ws.rsp |
Your plan should work well. | |
Just something to keep in mind when working on websockets: the transer mode used by Cheyenne to reply to clients is "text" mode. This mode requires UTF-8 encoding and IIRC, the browser is allowed to reject your response and close the connection if the response is wrongly encoded. | |
Endo 9-Dec-2011 [11048] | Is it UTF-8 in your chat example? Cheyenne converts text to UTF-8? Text mode is ok to me. By the way, I tested ws.html in Cheyenne sources on my XP/Home yesterday with Chrome, it closes the connection immediately. But it works here now, on XP/Pro with Chrome. |
Dockimbel 9-Dec-2011 [11049x2] | Chat demo: no conversion, it's UTF-8 as long as everyone talks in english. ;-) |
ws.html: same Chrome version on both machines? | |
older newer | first last |