[Vortex] weird behavior or misunderstanding of beep/vortex?

Francis Brosnan Blazquez francis at aspl.es
Thu Jun 8 08:31:51 CEST 2006


El mié, 07-06-2006 a las 19:33 -0300, Gustavo Sverzut Barbieri escribió:
> Hello,
> 

Hi Gustavo!

> I'm developing a software using BEEP/Vortex and both client and server
> must 
> send messages. I mean, differently from HTTP, where just client can
> start the 
> requisition, in my case, server could also send information to client
> without 
> it asking for... you can understand this as both acting as server and
> client. 
> This is a requirement for various reasons and we don't want to follow
> the 
> "pooling" behaviour of AJAX apps.

Ok. 

> 
> However, I'm with problems using vortex for this purpose. What happens
> right 
> now is:
> 
> #### "client"
> beep_client_connect: connected to 127.0.0.1:12345, channel #5
> connection_send_msg: 127.0.0.1:12345 channel#5
> channel_send_msg: channel#5 
> channel_send_msg: channel#5 wait replay #0...
> channel_send_msg: channel#5 got reply #0: 1
> 
> <notice no message is received after this point!>
> 

I think the problem is here, without taking a look into the source code.

>From the log reported by your client application, it seems to be using
the "wait reply method" as described at [1]. 

However, this method is only useful for a few cases, for example, while
implementing a profile. This is because the wait reply method must be
armed [2] and then activated [3] to perform a synchronous waiting,
getting blocked, until a particular reply, for a particular message, for
a particular channel. 

Another key point to take into account while using "wait reply" is that
it only supports waiting for an RPY or a ERR frame. As a consequence,
all frames received that don't match with previous types, that is,
MSG/ANS/NUL, are not notified.

What I think you should use is the frame_received handler to process all
replies received for a channel. That handler is configured while calling
to [4] or [5].

Briefly:
* You create a channel, using a particular profile, setting the frame
received handler. 

* You send messages as usual, using a channel with frame_received
handler configured, without performing an explicit wait just before the
sending function returns.

* If the server replies to a message received, generating a
RPY/ERR/ANS/NUL, or the server initiates a transaction (using MSG), all
those frames will be received at the client application, notified
through the frame received handler.

> 
> Also, I have this connection_send_msg and channel_send_msg split
> because I may 
> have multiple clients (and thus connections) that should receive the
> same 
> information. There is any better way to broadcast this or the right
> way is to 
> iterate (vortex_connection_foreach_channel())? 

We could add a broadcast API to send a message to all channels inside a
connection, howerver, you are doing, essentially, the same stuff. Seems
to be interesting. I've filled a bug for these issue [6].

Cheers!

[1]
http://www.aspl.es/fact/files/af-arch/vortex/html/starting_to_program.html#vortex_manual_wait_reply

[2]
http://www.aspl.es/fact/files/af-arch/vortex/html/group__vortex__channel_g6449560e336f24f5b59f1df7e12b6ca9.html#g6449560e336f24f5b59f1df7e12b6ca9

[3]
http://www.aspl.es/fact/files/af-arch/vortex/html/group__vortex__channel_gf80f717ffc6d240265a3543ad92171e2.html#gf80f717ffc6d240265a3543ad92171e2

[4]
http://www.aspl.es/fact/files/af-arch/vortex/html/group__vortex__channel_g25d81a9493c1621782fbbab2284ae54a.html#g25d81a9493c1621782fbbab2284ae54a

[5]
http://www.aspl.es/fact/files/af-arch/vortex/html/group__vortex__channel_ga9a2ac8a667a4d332a54046935649db2.html#ga9a2ac8a667a4d332a54046935649db2

[6]
http://dolphin.aspl.es/cgi-bin/bugzilla/show_bug.cgi?id=319

-- 
Francis Brosnan Blazquez <francis at aspl.es>
Advanced Software Production Line, S.L.




More information about the Vortex mailing list