Arc Forumnew | comments | leaders | submitlogin
1 point by skenney26 6101 days ago | link | parent

Am I correct in thinking that asv only supports one-way asynchronous communication from the client to the server? If so, does anyone have any ideas for supporting two-way async?


2 points by kens 6101 days ago | link

Actually asv doesn't even support that. It has jfnurl* which is called an asynchronous request, but really it's just a normal request with the result thrown away. The client still blocks for the duration of the request, so nothing is really asynchronous. I suspect asynchronous communication is a not-yet-implemented feature.

But to answer your question, it depends what you mean by two-way async. HTTP only supports requests from the client to the server, so you need to use something like polling, Ajax, HTTP server push, or Comet (see http://en.wikipedia.org/wiki/Comet_%28programming%29). I don't think there's anything in srv.arc that would prevent a persistent server connection, if threadlife* is increased from 30 seconds. (A thread per persistent connection would eventually have scaling issued, though, I think.)

-----

3 points by kens 6100 days ago | link

I took a closer look at using Ajax with Arc. It turns out to be pretty easy, thanks to script.aculo.us. I've written details at http://arcfn.com/2008/04/ajax-and-arc.html - please let me know if it works for you or not.

-----

2 points by kens 6098 days ago | link

I've substantially changed my example, so it now fetches country data using Ajax.

The biggest problem with using Ajax is that the Arc web server doesn't support .js files, which is a big oversight for a web-targeted language. Consider this a bug report suggesting support for .js static files. (Really the design should allow arbitrary static files with arbitrary mime-types, rather than hard-coding the list.)

If anyone has Arc running on a public web server and wants to run the Ajax example, let me know and I'll add a link to your site from my page. (My hosting isn't suitable for running Arc.)

-----

1 point by absz 6098 days ago | link

Actually, the Anarki supports exactly what you want with static files: a root directory for static files, and a table mapping extensions to mime types for them.

And there's a typo on your page: you don't close the code tag around "/getcontents?field=population&name=value", so the rest of the page is in monospaced font.

That said, your site is consistently fantastic, and I find it amazingly useful. Please keep it up!

-----

1 point by skenney26 6101 days ago | link

I was referring to Ajax. Thanks for your input (and the great documentation).

-----