LuaLua Configuration API Reference for Realtime Apps

Lua complete API reference for building Realtime Applications on PubNub, including basic usage and sample code

require "pubnub"
This function is used for initializing the PubNub Client API context. This function must be called before attempting to utilize any API functionality in order to establish account level credentials such as publish_key and subscribe_key.
To Initialize Pubnub you can use the following method(s) in the Lua SDK:
  1. ParameterTypeRequiredDescription
    configurationtableYesTable of initialization parameters (a kind of prototype to construct the PubNub object from). See Configuration Parameters for more details.
    publish_keystringOptional (required only for publish)noneThe PubNub publish key.
    subscribe_keystringYesnoneThe PubNub subscribe key.
    secret_keystringOptionalnoneThe secret key.
    auth_keystringOptionalnoneThe auth key to access channels.
    sslbooleanOptionalfalseWhether to use SSL to connect to PubNub.
    originstringOptionalps.pndsn.comThe domain name to use to connect to PubNub.
    uuidstringOptionalauto generatedThe UUID used to identify this client to PubNub.
require "pubnub"

local pubnub_obj ={
    publish_key = "demo",
    subscribe_key = "demo",
    secret_key = "demo",
    ssl = false,
    origin = ""
It returns the Pubnub instance for invoking PubNub APIs like publish(), subscribe(), history(), here_now(), etc.