void vortex_channel_set_closed_handler ( VortexChannel channel,
VortexOnClosedChannel  closed,
axlPointer  user_data 

Allows to configure the closed handler: a notification that the channel is about to be removed from the connection.

This handler will be used by the vortex engine to provide a notification that the channel is about to be unrefered and disconnected from its connection becase it wasn't closed at the time the connection is being terminated. This handler is provided because the connection is not working and there is no way to perform proper close on channels found installed.

This is useful to get notifications about a channel that was not closed properly (so the close handler can't be called: vortex_channel_set_close_handler).

channelThe channel to configure.
closedThe handler to configure.
user_dataUser defined pointer to be provided to the handler called.

NOTE: this function is not called if a channel was created and properly closed. This handler is called at connection termination. This means that channels that aren't available at this phase (because they was closed properly) aren't notified.

What are the differences between vortex_channel_set_close_handler and vortex_channel_set_closed_handler?

This handler (vortex_channel_set_closed_handler) is a notification that the channel reference is about to be removed from the connection, while vortex_channel_set_close_handler is a notification that the remote side is requesting to close the channel. That is, the vortex_channel_set_close_handler allows to control if the channel will be closed (it is still running when the notification is received), while vortex_channel_set_closed_handler do not provide any control: just notification.

Another difference is that the channel reference received on this handler (vortex_channel_set_closed_handler) represents a closed channel. In the case of vortex_channel_set_close_handler, the channel is available and running (unless connection broken event) when the notification is received. The same state applies to the connection holding the channel.