Exemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();

            var coreConfig = new AVClient.Configuration
            {
                ApplicationId  = appId,
                ApplicationKey = appId,
            };

            AVClient.Initialize(coreConfig);
            AVClient.HttpLog(AppendLogs);

            var realtimeConfig = new AVRealtime.Configuration()
            {
                ApplicationId          = appId,
                ApplicationKey         = appkey,
                OfflineMessageStrategy = AVRealtime.OfflineMessageStrategy.UnreadAck,
            };

            Websockets.Net.WebsocketConnection.Link();
            AVRealtime.WebSocketLog(AppendLogs);

            realtime = new AVRealtime(realtimeConfig);

            lbx_messages.DisplayMember = "Content";
            lbx_messages.ValueMember   = "Id";
            lbx_messages.DataSource    = data;

            realtime.OnOfflineMessageReceived += Realtime_OnOfflineMessageReceived;
        }
Exemplo n.º 2
0
        public virtual void SetUp()
        {
            string appId  = "cfpwdlo41ujzbozw8iazd8ascbpoirt2q01c4adsrlntpvxr";
            string appkey = "lmar9d608v4qi8rvc53zqir106h0j6nnyms7brs9m082lnl7";

            //string appId = "EB23wEzd6WPhGlwjMVgEPxg6-gzGzoHsz";
            //string appkey = "6jEGd98CIOUyH6LQrotQSNVb";

            Websockets.Net.WebsocketConnection.Link();

            var coreConfig = new AVClient.Configuration
            {
                ApplicationId  = appId,
                ApplicationKey = appId,
            };

            AVClient.Initialize(coreConfig);
            AVClient.HttpLog(AppendLogs);

            var realtimeConfig = new AVRealtime.Configuration()
            {
                ApplicationId          = appId,
                ApplicationKey         = appkey,
                RealtimeServer         = new Uri("wss://rtm51.leancloud.cn"),
                OfflineMessageStrategy = AVRealtime.OfflineMessageStrategy.Default
            };

            AVRealtime.WebSocketLog(AppendLogs);

            realtime = new AVRealtime(realtimeConfig);
        }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        var sc     = GameObject.FindObjectOfType <MyWebSocketClient>();
        var config = new AVRealtime.Configuration()
        {
            ApplicationId   = "uay57kigwe0b6f5n0e1d4z4xhydsml3dor24bzwvzr57wdap",
            ApplicationKey  = "kfgz7jjfsk55r5a8a3y4ttd3je1ko11bkibcikonk32oozww",
            WebSocketClient = sc // 使用已经初始化的 WebSocketClient 实例作为 AVRealtime 初始化的配置参数
        };

        AVRealtime.WebSocketLog(UnityEngine.Debug.Log);

        RealtimeInstance = new AVRealtime(config);
        RealtimeInstance.RegisterMessageType <Emoji>();
        RealtimeInstance.RegisterMessageType <NikkiMessage>();
    }
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            Websockets.Net.WebsocketConnection.Link();
            //var config = new AVRealtime.Configuration()
            //{
            //    ApplicationId = "021h1hbtd5shlz38pegnpkmq9d3qf8os1vt0nef4f2lxjru8",
            //    ApplicationKey = "3suek8gdtfk3j3dgb42p9o8jhfjkbnmtefk3z9500balmf2e",
            //    SignatureFactory = new LeanEngineSignatureFactory()
            //};
            string appId  = "021h1hbtd5shlz38pegnpkmq9d3qf8os1vt0nef4f2lxjru8";
            string appKey = "3suek8gdtfk3j3dgb42p9o8jhfjkbnmtefk3z9500balmf2e";
            var    config = new AVRealtime.Configuration()
            {
                ApplicationId  = appId,
                ApplicationKey = appKey,
                //SignatureFactory = new LeanEngineSignatureFactory()
            };

            realtime = new AVRealtime(config);
            realtime.RegisterMessageType <Emoji>();
            realtime.RegisterMessageType <EmojiV2>();
            realtime.RegisterMessageType <BinaryMessage>();

            this.CenterContent = new LogIn();
            var logInVM = ServiceLocator.Current.GetInstance <LogInViewModel>();

            logInVM.realtime = realtime;
            logInVM.client   = CurrentClient;

            logInVM.PropertyChanged += LogInVM_PropertyChanged;

            this.LogContent = new WebSocketLog();
            var logVM = ServiceLocator.Current.GetInstance <WebSocketLogViewModel>();

            var teamVM = ServiceLocator.Current.GetInstance <TeamViewModel>();

            teamVM.PropertyChanged += TeamVM_PropertyChanged;
        }