I saw some socket example are all written in c#and I found nothing when i am searching the socket api on script documentationdoes unity has socket api or i have to use the c# api to do a socket connection in other wordsdoes that means js can't do everything that c# can do
1 Answer
1Hello wuesugi,
You can access and you can send message to Smartfox Server in javascript. But NetworkController must be in parent folder and You must import smartfox libs.
import SmartFox;
import SmartFoxClientAPI;
import SmartFoxClientAPI.Data;
Exaple :
import SmartFox;
import SmartFoxClientAPI;
import SmartFoxClientAPI.Data;
function Start()
{
var client : SmartFoxClient ;
var data : SFSObject ;
data = new SFSObject();
client = NetworkController.GetClient();
data.Put("_cmd","c"); // Create message
data.Put("name", gameObject.name);
client.SendObject(data);
}
}
}
Regards