Skip to content

Instantly share code, notes, and snippets.

View novabyte's full-sized avatar

Chris Molozian novabyte

View GitHub Profile
@novabyte
novabyte / onesignal.lua
Last active July 27, 2017 11:37
An example on how to send a push notification via One Signal with Nakama server.
local nk = require("nakama")
--[[
Send a push notification to a segment of users via One Signal.
]]--
local function send_push_notification(context, payload)
local auth = "YOUR ONE SIGNAL REST API KEY"
local url = "https://onesignal.com/api/v1/notifications"
local method = "POST"
@novabyte
novabyte / setupuser.lua
Created July 21, 2017 12:11
An example of optimistic concurrency control to setup a new user's storage records with Nakama server.
local nk = require("nakama")
local function setup_user(context, _)
local value = {
coins = 100
level = 1
}
local record = {
Bucket = "mygame",
Collection = "saves",