Real-Time Gaming Blog

Corona SDK Multiplayer Networking API for Mobile Games

2 min readStephen Blum on Nov 12, 2011
Try PubNub Today

Free up to 1MM monthly messages. No credit card required.

Subscribe to our newsletter

By submitting this form, you are agreeing to our Terms and Conditions and Privacy Policy.

We've updated our SDKs, and this code is now deprecated. Good news is we've written a comprehensive guide to building a multiplayer game. Check it out! Enable multiplayer networking with your mobile g...

Warning

We’ve updated our SDKs, and this code is now deprecated.

Good news is we’ve written a comprehensive guide to building a multiplayer game. Check it out!

Enable multiplayer networking with your mobile games with three functions:

  1. Init PubNub Multiplayer Object
  2. Call Subscribe() to begin receiving messages.
  3. Call Publish() to send messages.

Additionally, you can take a look at the Corona SDK website here. We’ll be using the Corona SDK with the multiplayer networking API.

multiplayer networking api

Follow these easy steps to get starting with your Multiplayer API.

  1. Download Lua Corona Multiplayer API
  2. Get Your PubNub Keys
  3. Copy the files into your Lua Code Directory
  4. Continue Reading to add just 3 functions to Enable Multiplayer Support.

Get Your PubNub Keys Here

To get your PubNub keys, first sign up for a free account. All your keys are available in our Developer’s Portal after signing up.

Learn about PubNub Cloud-Hosted Service for Real-time Messaging

PubNub is a new kind of Cloud-Hosted Broadcasting Service for Mass Communication on Mobile Phones, Tablets, TVs, HTML5 Web Browsers and Game Consoles. Already more messages are published to PubNub each day than to Twitter. We believe in unified broadcasting and mass communication empowerment for application and game developers who build on Mobile Phones, TVs, HTML5 Web Browsers, Tablets and Game Consoles.

Below are code snippets you’ll need to get going:

Initiate Multiplayer PubNub Object

You’ll first need to sign up for a PubNub account. Once you sign up, you can get your unique PubNub keys in the PubNub Developer Portal. Once you have, clone the GitHub repository, and enter your unique PubNub keys on the PubNub initialization.

Listen for Messages from Other Players

Send Message To Other Players

Stop Listening for Messages

Load Message History

Get PubNub Server Time

Get Started
Sign up for free and use PubNub to power multiplayer gaming

More from PubNub

How to Advance Telehealth and Virtual Care Technologies
News May 2, 20221 min read

How to Advance Telehealth and Virtual Care Technologies

Dr. Joe Kvedar, Chair of the Board for the American Telemedicine Association, joins our COO, Casey Clegg, to discuss why...

PubNub Staff

PubNub Staff

Another Step Towards Data Security: ISO-27001 Implementation
BuildMay 2, 20221 min read

Another Step Towards Data Security: ISO-27001 Implementation

Today, we are glad to announce that we are currently in the process of implementing ISO-27001 security standards.

PubNub Staff

PubNub Staff

Improving Virtual Care in a Post-Pandemic World
News Apr 14, 20221 min read

Improving Virtual Care in a Post-Pandemic World

Meg Barron, VP of Digital Health Strategy at the AMA, talks with PubNub’s COO, Casey Clegg, about what’s next for the healthcare...

PubNub Staff

PubNub Staff