msys.delivery.ob_get_current_message

March 26, 2020 Contributors

Name

msys.delivery.ob_get_current_message — Get the current message from the session context

Synopsis

msys.delivery.ob_get_current_message(sess.connh);

sess.connh: userdata, session context type

Description

Get the current message from the session context.

Enable this function with the statement require('msys.delivery');.

require("msys.delivery");

local mod = {};
function mod:generic_delivery_http_response_eval(sess)
  -- get the message
  local msg = msys.delivery.ob_get_current_message(sess.connh)
  -- check protocol
  if(msg:get_delivery_method() == "gcm") then
    -- do something with a GCM message
    ...
  else 
    -- not our protocol get out
    return msys.delivery.DELIVERY_CONTINUE
  end  
end

msys.registerModule("http_delivery", mod);

See Also

Momentum for Mobile Push Notifications