예제 #1
0
        public void Dispose()
        {
            Debug.Log(string.Format("PitayaClient Disposed {0}", _client));
            if (_disposed)
            {
                return;
            }

            if (_eventManager != null)
            {
                _eventManager.Dispose();
            }

            _reqUid = 0;
            PitayaBinding.Disconnect(_client);
            PitayaBinding.Dispose(_client);

            _client   = IntPtr.Zero;
            _disposed = true;
        }
예제 #2
0
        private void Init(string certificateName, bool enableTlS, bool enablePolling, bool enableReconnect, int connTimeout)
        {
            _eventManager          = new EventManager();
            _typeRequestSubscriber = new TypeSubscriber <uint>();
            _typePushSubscriber    = new TypeSubscriber <string>();
            _client = PitayaBinding.CreateClient(enableTlS, enablePolling, enableReconnect, connTimeout, this);

            if (certificateName != null)
            {
#if UNITY_EDITOR
                if (File.Exists(certificateName))
                {
                    PitayaBinding.SetCertificatePath(certificateName);
                }
                else
                {
                    PitayaBinding.SetCertificateName(certificateName);
                }
#else
                PitayaBinding.SetCertificateName(certificateName);
#endif
            }
        }
예제 #3
0
        public void Connect(string host, int port, Dictionary <string, string> handshakeOpts)
        {
            var opts = Pitaya.SimpleJson.SimpleJson.SerializeObject(handshakeOpts);

            PitayaBinding.Connect(_client, host, port, opts);
        }
예제 #4
0
 public void Connect(string host, int port, string handshakeOpts = null)
 {
     PitayaBinding.Connect(_client, host, port, handshakeOpts);
 }
예제 #5
0
 public static void SetLogLevel(PitayaLogLevel level)
 {
     PitayaBinding.SetLogLevel(level);
 }
예제 #6
0
 public void Disconnect()
 {
     PitayaBinding.Disconnect(_client);
 }
예제 #7
0
 public void Notify(string route, int timeout, string msg)
 {
     PitayaBinding.Notify(_client, route, JsonSerializer.Encode(msg), timeout);
 }
예제 #8
0
        public void Notify(string route, int timeout, IMessage msg)
        {
            var serializer = PitayaBinding.ClientSerializer(_client);

            PitayaBinding.Notify(_client, route, ProtobufSerializer.Encode(msg, serializer), timeout);
        }
예제 #9
0
 public void Connect(string host, int port)
 {
     PitayaBinding.Connect(_client, host, port);
 }