Browsers are asynchronous. You pretty much will have to get used
to/learn to do things asynchronously.

You can probably cobble together some horrible hack to emulate
synchronous programming in the browser but it will be just that, a
hack and your UI will definitely freeze and probably be unusable.
Basically the trick will be to figure out a way to make a function
call block (and your entire application) while you continuously check
if a response came.back.

 - lex

On Wed, Apr 4, 2012 at 6:51 AM, João Ventura <[email protected]> wrote:
> Hello everyone,
>
> I've searched for this subject and found some (rather old) emails, so I
> haven't reached any conclusion about the possibility/interest of doing
> synchronous json-rpc calls in Pyjs, ie, didn't understand if it is
> possible or not. But i'll try to explain my case..
>
> I'm converting a desktop application to pyjs, and it has an API. It is
> an MVC app. Regarding the API, the logical decision was that everything
> pure-python would go the the client, and C-extensions and modules which
> needs to access information from files will go to the server. So, using
> "jsonrpclib" I've abstracted my API enough that i just set a flag to
> change some requests from local to jsonrpc. It is transparent to my app
> from where the data comes from.. It is pretty cool! :)
>
> However, my problem is that only now I've found out that pyjamas doesn't
> seem to handle synchronous jsonrpc calls. Or at least, the JsonRPC
> example is based on async handling of jsonrpc calls. I've tried to
> import jsonrpclib to pyjs but something needs to be fixed (or in pyjs or
> in jsonrpclib, I still don't know).
>
> So, as I would like to maintain the synchronous aspect of my API in the
> client (because it is already done that way, and I may use it in other
> situations), I would ask if anyone knows something about this, i.e.,
> about doing synchronous jsonrpc calls in pyjamas?
>
> Basically, is synchronous jsonrpc available in pyjs (or in browsers)?
> What are the downsides of it (does delays in response hang the browser
> entirelly or just my app tab)?
>
>
> Thanks,
> João Ventura

Reply via email to