Skip to content

Instantly share code, notes, and snippets.

@kou-yeung
Last active December 17, 2016 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kou-yeung/717815f8db946051bed097788a5b7894 to your computer and use it in GitHub Desktop.
Save kou-yeung/717815f8db946051bed097788a5b7894 to your computer and use it in GitHub Desktop.
Milkcocoa for UnityWebGL Sample
using UnityEngine;
using Milkcocoa;
class Message
{
public string value;
}
class Foo
{
MilkCocoa milkcocoa = new MilkCocoa("Your API Key");
DataStore dataStore;
void Start()
{
dataStore = milkcocoa.DataStore("chat");
dataStore.OnSend((json) => {
var message = JsonUtility.FromJson<Message>(json);
Debug.Log(message.value); // "Hello!!" will be display.
});
dataStore.Send(JsonUtility.ToJson(new Message{value = "Hello!!"}));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment