Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

I had a similar issue, please see my submission page. I submitted regardless, hopefully we can get this figured out.

(+1)

Hi, we were able to work with Kalinka to resolve this. It seems the Unity plugin doesn't easily support authentication with our servers (we did not develop it, another member of the Nano community did). I will be putting up a pull request later this week to fix this, which will hopefully be accepted! In the meantime however, you will need to make some manual changes to the code in your integration with the plugin. Here are the instructions:

In the Nano Plugin, under Nano > Plugins > Nano there should be a NanoWebsocket.cs file. If you open this up, you will need to add the following lines of code:

Under the using section:

using System.Text;

 In async void Start(), as the first lines in the function:

byte[] bytesToEncode = Encoding.UTF8.GetBytes ("<yourkey>:<yoursecret>");
string auth = "Basic " + Convert.ToBase64String (bytesToEncode);
Dictionary<string, string> headers = new Dictionary<string, string>();
headers.Add("Authorization", auth);
websocket = new WebSocket(url, headers);

The last line there is replacing the existing line of websocket = new WebSocket(url);

In the Nano Plugin under Nano > Plugins > Nano there should be a RPC.cs file. In here, you will need to replace the beginning of the RPC class with the following:

      public class RPC
      {
        public string url;
        private string auth;
        public RPC(string url)
        {
          this.url = url;
          byte[] bytesToEncode = Encoding.UTF8.GetBytes ("<yourkey>:<yoursecret>");
          this.auth = "Basic " + Convert.ToBase64String (bytesToEncode);
        }
        public IEnumerator MakeRequest(UnityWebRequest webRequest, byte[] body, Action<string> callback)
        {
          webRequest.uploadHandler = new UploadHandlerRaw(body);
          webRequest.downloadHandler = new DownloadHandlerBuffer();
          webRequest.SetRequestHeader("Content-Type", "application/json");
          webRequest.SetRequestHeader("Accepts", "application/json");
          webRequest.SetRequestHeader("Authorization", this.auth);

The key additions here are: generating the authorization when the class is initialized, and then adding it in every request made.

ALSO, very important, make sure you replace the instances of <yourkey> and <yoursecret> with a key and secret that you generate on your account on the Madora website.

There may also be some issues with the websocket that I am still investigating (it does not perform keep-alive properly, so it keeps timing out after 1 minute. This should be an easy fix but I haven't had time yet). Let me know if you have any questions, and if there's anything else I can do to help!

(+1)

Actually, I think we have been able to resolve the websocket issue on our server side. With the code I posted earlier, everything should be there to integrate Nano + Unity + Madora. Please let me know if you run into any other issues!