vortex.channel — LuaVortexchannel class: BEEP channel creation and management

Intro

API documentation for vortex.channel object representing a BEEP channel.

Module API

class vortex.channel
send_msg(content[, size])

Allows to send a message (content) with the size provided.

Parameters:
  • content (String (may contain binary data like 0)) – The content to send.
  • size (Integer) – Optional content size indication or -1 to let the function to deduce string size.
Return type:

Returns the msg_no used for the send operation or nil if the send operation fails.

Note the proper manner to detect if the send operation was done is to use:

msg_no = channel:send_msg (content, size)
if msg_no == nil then
   print ("ERROR: failed to send message")
   -- return or appropriate error recover
end if
send_rpy(content, size, msg_no)

Allows to send a reply message (frame type RPY) to a message received (frame type MSG) with the provided msg_no.

Parameters:
  • content (String (may contain binary data like 0)) – The content to send.
  • size (Integer) – The content size or -1 to let the function to deduce string size.
  • msg_no (Integer > 0) – The frame msgno that identifies the frame MSG we are replying
Return type:

Returns true if the reply operation was done, otherwise false is returned.

send_err(content, size, msg_no)

Allows to send an error reply message (frame type ERR) to a message received (frame type MSG) with the provided msg_no.

Parameters:
  • content (String (may contain binary data like 0)) – The content to send.
  • size (Integer) – The content size or -1 to let the function to deduce string size.
  • msg_no (Integer > 0) – The frame msgno that identifies the frame MSG we are replying
Return type:

Returns true if the reply operation was done, otherwise false is returned.

send_ans(content, size, msg_no)

Allows to send a reply message (frame type ANS) to a message received (frame type MSG) with the provided msg_no.

Parameters:
  • content (String (may contain binary data like 0)) – The content to send.
  • size (Integer) – The content size or -1 to let the function to deduce string size.
  • msg_no (Integer > 0) – The frame msgno that identifies the frame MSG we are replying
Return type:

Returns true if the reply operation was done, otherwise false is returned.

finalize_ans(msg_no)

Finish an ANS exchange with the last NUL frame (created by this method).

Parameters:msg_no (Integer > 0) – The frame msgno that identifies the frame MSG we are replying with the last NUL.
Return type:Returns true if the reply operation was done, otherwise false is returned.
set_frame_received(handler, data)

Allows to configure the frame received handler (the method or function that will be called for each frame received over this channel). The frame handler must have the following signature:

function frame_received (conn, channel, frame, data)
    -- handle frame received
    return
end
Parameters:
  • handler (Frame received handler.) – The handler to configure
  • data (Object) – User defined data passed to the frame received handler.
close()

Allows to request close the channel. The function will issue a close request that must be accepted by remote BEEP peer.

Return type:Returns true if the channel was closed, otherwise false is returned. In the case false is returned you can use connection.pop_channel_error().
check(channel)
Parameters:channel (vortex.channel) – The channel.

Allows to check if the provided vortex.channel is indeed a vortex.channel object.

Return type:Returns true in the case it is a vortex.channel object. Otherwise, false is returned.
number

(Read only attribute) (Number) returns the channel number.

profile

(Read only attribute) (String) returns the channel profile.

is_ready

(Read only attribute) (true/false) returns is ready status. See vortex_channel_is_ready for more information.

conn

(Read only attribute) (vortex.connection) returns a reference to the connection where the channel is working.

set_serialize

(Write only attribute) (true/false) Allows to configure channel delivery serialization. See also vortex_channel_set_serialize.