コード例 #1
0
        //Stomp Connect...
        public InitCallBack StompConnect()
        {
            if (connecting || connectedDone.isDone())
            {
                return(connectedDone);
            }
            connecting           = true;
            websocket.OnOpen    += onOpened;
            websocket.OnMessage += (sender, e) => {
                WsResponse resp = new WsResponse(e);
                if (resp.parse())
                {
                    string key = getKeyByDestination(resp.getDestination());
                    if (key != null)
                    {
                        subscribeIdMap[key].onMsg(resp.getMessage());
                    }
                }
            };
            websocket.OnError += (sender, e) => {
                //Debug.Log("Error message : " + e.Message);
                onErrorCb("");
            };

            websocket.OnClosed += (a, b, c) => {
                onCloseCb(c);
            };
            websocket.Open();
            return(connectedDone);
        }
コード例 #2
0
        public FirebaseAuther auth()
        {
            if (initCB.isDone())
            {
                return(this);
            }
            FirebaseAuth auth = Firebase.Auth.FirebaseAuth.DefaultInstance;

            auth.SignInWithEmailAndPasswordAsync(email, pass).ContinueWith(task => {
                if (task.IsCanceled)
                {
                    Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled.");
                    return;
                }
                if (task.IsFaulted)
                {
                    Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception);
                    return;
                }

                user = task.Result;
                UnityMainThreadDispatcher.uniRxRun(() => {
                    initCB.done();
                    Debug.Log("auth.done");
                });
                Debug.LogFormat("Firebase user login successfully: {0} ({1})",
                                user.DisplayName, user.UserId);
            });
            return(this);
        }