Synchronous PHP library

40 views
Skip to first unread message

Janusz Szczypka

unread,
Mar 12, 2018, 5:44:26 PM3/12/18
to WAMP
Hi,

I discovered WAMP few days ago and quickly adopted it to my recent project.

I am fine with asynchronous Javascript but async PHP is very strange. As I have backend in PHP that calls does some RPC to Javascript clients, I have to use async library like RxPHP just to call a remote function which does not require any asynchronousness - just simple call and get back result or have an exception thrown. The same could also work for publish but obviously not for register and subscribe.

Does anybody knows of a library that could make WAMP call synchronously?
Or a way to convert RxPHP (or other library) async method to sync method? The only one I could think of is calling wait in loop until some global variable will get result from async call.

Best regards,
Janusz

Johan 't Hart

unread,
Apr 3, 2018, 5:16:22 PM4/3/18
to WAMP
Hi,

I'm not really into PHP, but I am into Rx.
How about simply awaiting the rx result? It turns an observable into a generator which can be iterated synchronously.

It's of course usually not recommended to block a thread waiting for an async result, but since this is what you ask, you can do it like this I think...

Greetings,
Johan

adhiem sumitro

unread,
Apr 4, 2018, 12:21:29 PM4/4/18
to WAMP
Using http-bridge, curl and backticks?
Reply all
Reply to author
Forward
0 new messages