public static void Main(string[] args) { string peerServer = "ws://localhost:8080/ws"; if (args.Length == 1) { peerServer = args[0]; } TestPeer app = new TestPeer(); if (!HumbleNet.Init()) { Console.WriteLine("Failed to startup"); return; } HumbleNet.P2P.Initialize(peerServer, "client_token", "client_secret", null); app.Start(); while (app.Run()) { } app.Stop(); HumbleNet.Shutdown(); }
// Use this for initialization static public void Init(string server) { if (!_isInitialized) { _myPeer = HumbleNet.PeerId.Invalid; if (!HumbleNet.Init()) { throw new System.DllNotFoundException(string.Format("Could not locate HumbleNet! : {0}", HumbleNet.getError())); } HumbleNet.P2P.Initialize(server, "WebGLRoller", "<WebGLRoller secret>", null); HumbleNet.P2P.Wait(0); #if !UNITY_WEBGL && USE_THREAD Poller.Init(); #endif _isInitialized = true; } }