Create a gist now

Instantly share code, notes, and snippets.

@kou-yeung /Milkcocoa.cs Secret
Last active Dec 17, 2016

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