Пример #1
0
    public void Start(string endpoint, long pid, long uid, string token)
    {
        client = LoginRTM(endpoint, pid, uid, token);

        if (client == null)
        {
            Debug.Log("User " + uid + " login RTM failed.");
            return;
        }

        GetOnlineUsers(client, new HashSet <long>()
        {
            99688848, 123456, 234567, 345678, 456789
        });

        SetUserInfos(client, "This is public info", "This is private info");
        GetUserInfos(client);

        Debug.Log("======== =========");

        SetUserInfos(client, "", "This is private info");
        GetUserInfos(client);

        Debug.Log("======== =========");

        SetUserInfos(client, "This is public info", "");
        GetUserInfos(client);

        Debug.Log("======== only change the private infos =========");

        SetUserInfos(client, null, "balabala");
        GetUserInfos(client);

        SetUserInfos(client, "This is public info", "This is private info");
        client.Bye();

        Debug.Log("======== user relogin =========");

        client = LoginRTM(endpoint, pid, uid, token);

        if (client == null)
        {
            return;
        }

        GetUserInfos(client);

        GetUsersInfos(client, new HashSet <long>()
        {
            99688848, 123456, 234567, 345678, 456789
        });

        Debug.Log("============== Demo completed ================");
    }
Пример #2
0
    public void Start(string endpoint, long pid, long uid, string token)
    {
        client = LoginRTM(endpoint, pid, uid, token);

        if (client == null)
        {
            Debug.Log("User " + uid + " login RTM failed.");
            return;
        }

        Debug.Log("=========== Begin set user data ===========");

        SetData(client, "key 1", "value 1");
        SetData(client, "key 2", "value 2");

        Debug.Log("=========== Begin get user data ===========");

        GetData(client, "key 1");
        GetData(client, "key 2");

        Debug.Log("=========== Begin delete one of user data ===========");

        DeleteData(client, "key 2");

        Debug.Log("=========== Begin get user data after delete action ===========");

        GetData(client, "key 1");
        GetData(client, "key 2");

        Debug.Log("=========== User logout ===========");

        client.Bye();

        Debug.Log("=========== User relogin ===========");

        client = LoginRTM(endpoint, pid, uid, token);

        if (client == null)
        {
            return;
        }

        Debug.Log("=========== Begin get user data after relogin ===========");

        GetData(client, "key 1");
        GetData(client, "key 2");

        Debug.Log("============== Demo completed ================");
    }
Пример #3
0
    public void Start(string endpoint, long pid, long uid, string token)
    {
        client = LoginRTM(endpoint, pid, uid, token);

        if (client == null)
        {
            Debug.Log("User " + uid + " login RTM failed.");
            return;
        }

        AddAttributesDemo(client);
        GetAttributesDemo(client);

        GetDevicePushOption(client);
        AddDevicePushOption(client, MessageCategory.P2PMessage, 12345);
        AddDevicePushOption(client, MessageCategory.GroupMessage, 223344, new HashSet <byte>());

        AddDevicePushOption(client, MessageCategory.P2PMessage, 34567, null);
        AddDevicePushOption(client, MessageCategory.GroupMessage, 445566, new HashSet <byte>()
        {
            23, 35, 56, 67, 78, 89
        });

        GetDevicePushOption(client);

        RemoveDevicePushOption(client, MessageCategory.GroupMessage, 223344, new HashSet <byte>()
        {
            23, 35, 56, 67, 78, 89
        });
        RemoveDevicePushOption(client, MessageCategory.GroupMessage, 445566, new HashSet <byte>());

        GetDevicePushOption(client);

        RemoveDevicePushOption(client, MessageCategory.P2PMessage, 12345);
        RemoveDevicePushOption(client, MessageCategory.P2PMessage, 34567);
        RemoveDevicePushOption(client, MessageCategory.GroupMessage, 223344);
        RemoveDevicePushOption(client, MessageCategory.GroupMessage, 445566, new HashSet <byte>()
        {
            23, 35, 56, 67, 78, 89
        });

        GetDevicePushOption(client);

        client.Bye();
        Thread.Sleep(1000);

        Debug.Log("============== Demo completed ================");
    }
Пример #4
0
    public void Start(string endpoint, long pid, long uid, string token)
    {
        client = LoginRTM(endpoint, pid, uid, token);

        if (client == null)
        {
            Debug.Log("User " + uid + " login RTM failed.");
            return;
        }

        AddAttributesDemo(client);
        GetAttributesDemo(client);

        client.Bye();
        Thread.Sleep(1000);

        Debug.Log("============== Demo completed ================");
    }
Пример #5
0
    public void Start(string endpoint, long pid, long uid, string token)
    {
        client = LoginRTM(endpoint, pid, uid, token);

        if (client == null)
        {
            Debug.Log("User " + uid + " login RTM failed.");
            return;
        }

        Debug.Log("======== get group members =========");
        GetGroupMembers(client, groupId);

        Debug.Log("======== add group members =========");
        AddGroupMembers(client, groupId, new HashSet <long>()
        {
            99688868, 99688878, 99688888
        });

        System.Threading.Thread.Sleep(1500);   //-- Wait for server sync action.

        Debug.Log("======== get group members =========");
        GetGroupMembers(client, groupId);

        Debug.Log("======== delete group members =========");
        DeleteGroupMembers(client, groupId, new HashSet <long>()
        {
            99688878
        });

        System.Threading.Thread.Sleep(1500);   //-- Wait for server sync action.

        Debug.Log("======== get group members =========");
        GetGroupMembers(client, groupId);


        Debug.Log("======== get self groups =========");
        GetSelfGroups(client);


        Debug.Log("======== set group infos =========");

        SetGroupInfos(client, groupId, "This is public info", "This is private info");
        GetGroupInfos(client, groupId);

        Debug.Log("======== change group infos =========");

        SetGroupInfos(client, groupId, "", "This is private info");
        GetGroupInfos(client, groupId);

        Debug.Log("======== change group infos =========");

        SetGroupInfos(client, groupId, "This is public info", "");
        GetGroupInfos(client, groupId);

        Debug.Log("======== only change the private infos =========");

        SetGroupInfos(client, groupId, null, "balabala");
        GetGroupInfos(client, groupId);

        SetGroupInfos(client, groupId, "This is public info", "This is private info");
        client.Bye();

        Debug.Log("======== user relogin =========");

        client = LoginRTM(endpoint, pid, uid, token);

        if (client == null)
        {
            return;
        }

        GetGroupInfos(client, groupId);

        Debug.Log("============== Demo completed ================");
    }
Пример #6
0
    public void Start(string endpoint, long pid, long uid, string token)
    {
        client = LoginRTM(endpoint, pid, uid, token);

        if (client == null)
        {
            Debug.Log("User " + uid + " login RTM failed.");
            return;
        }

        Debug.Log("======== enter room =========");
        EnterRoom(client, roomId);

        Debug.Log("======== get self rooms =========");
        GetSelfRooms(client);

        Debug.Log("======== leave room =========");
        LeaveRoom(client, roomId);

        Debug.Log("======== get self rooms =========");
        GetSelfRooms(client);


        Debug.Log("======== enter room =========");
        EnterRoom(client, roomId);

        Debug.Log("======== set room infos =========");

        SetRoomInfos(client, roomId, "This is public info", "This is private info");
        GetRoomInfos(client, roomId);

        Debug.Log("======== change room infos =========");

        SetRoomInfos(client, roomId, "", "This is private info");
        GetRoomInfos(client, roomId);

        Debug.Log("======== change room infos =========");

        SetRoomInfos(client, roomId, "This is public info", "");
        GetRoomInfos(client, roomId);

        Debug.Log("======== only change the private infos =========");

        SetRoomInfos(client, roomId, null, "balabala");
        GetRoomInfos(client, roomId);

        SetRoomInfos(client, roomId, "This is public info", "This is private info");
        client.Bye();

        Debug.Log("======== user relogin =========");

        client = LoginRTM(endpoint, pid, uid, token);

        if (client == null)
        {
            return;
        }

        Debug.Log("======== enter room =========");
        EnterRoom(client, roomId);

        GetRoomInfos(client, roomId);

        Debug.Log("============== Demo completed ================");
    }
Пример #7
0
    public void Start(string endpoint, long pid, long uid, string token)
    {
        client = LoginRTM(endpoint, pid, uid, token);

        if (client == null)
        {
            Debug.Log("User " + uid + " login RTM failed.");
            return;
        }

        Debug.Log("======== enter room =========");
        EnterRoom(client, roomId);

        Debug.Log("======== get self rooms =========");
        GetSelfRooms(client);

        Debug.Log("======== leave room =========");
        LeaveRoom(client, roomId);

        Debug.Log("======== get self rooms =========");
        GetSelfRooms(client);


        Debug.Log("======== enter room =========");
        EnterRoom(client, roomId);

        Debug.Log("======== set room infos =========");

        SetRoomInfos(client, roomId, "This is public info", "This is private info");
        GetRoomInfos(client, roomId);

        Debug.Log("======== change room infos =========");

        SetRoomInfos(client, roomId, "", "This is private info");
        GetRoomInfos(client, roomId);

        Debug.Log("======== change room infos =========");

        SetRoomInfos(client, roomId, "This is public info", "");
        GetRoomInfos(client, roomId);

        Debug.Log("======== only change the private infos =========");

        SetRoomInfos(client, roomId, null, "balabala");
        GetRoomInfos(client, roomId);

        SetRoomInfos(client, roomId, "This is public info", "This is private info");
        client.Bye();

        Debug.Log("======== user relogin =========");

        client = LoginRTM(endpoint, pid, uid, token);

        if (client == null)
        {
            return;
        }

        Debug.Log("======== enter room =========");
        EnterRoom(client, roomId);

        GetRoomInfos(client, roomId);

        GetRoomsPublicInfo(client, new HashSet <long>()
        {
            556677, 778899, 445566, 334455, 1234
        });

        Debug.Log("======== get room members immediately =========");

        GetRoomMemberCount(client, new HashSet <long>()
        {
            roomId, 778899, 445566, 334455, 1234
        });
        GetRoomMembers(client, roomId);

        Debug.Log("======== get room members after 6 seconds =========");

        GetRoomMemberCount(client, new HashSet <long>()
        {
            roomId, 778899, 445566, 334455, 1234
        });
        GetRoomMembers(client, roomId);

        Debug.Log("============== Demo completed ================");
    }
Пример #8
0
        static void Main(string[] args)
        {
            if (args.Length != 4)
            {
                Console.WriteLine("Usage: RTMUsers <rtm-endpoint> <projectId> <uid> <token>");
                return;
            }

            //-- Testing only
            // ManualInitForTesting();

            string rtmEndpoint = args[0];
            long   projectId   = Int64.Parse(args[1]);
            long   uid         = Int64.Parse(args[2]);
            string token       = args[3];

            RTMClient client = LoginRTM(rtmEndpoint, projectId, uid, token);

            if (client == null)
            {
                return;
            }

            GetOnlineUsers(client, new HashSet <long>()
            {
                99688848, 123456, 234567, 345678, 456789
            });

            SetUserInfos(client, "This is public info", "This is private info");
            GetUserInfos(client);

            Console.WriteLine("======== =========");

            SetUserInfos(client, "", "This is private info");
            GetUserInfos(client);

            Console.WriteLine("======== =========");

            SetUserInfos(client, "This is public info", "");
            GetUserInfos(client);

            Console.WriteLine("======== only change the private infos =========");

            SetUserInfos(client, null, "balabala");
            GetUserInfos(client);

            SetUserInfos(client, "This is public info", "This is private info");
            client.Bye();

            Console.WriteLine("======== user relogin =========");

            client = LoginRTM(rtmEndpoint, projectId, uid, token);

            if (client == null)
            {
                return;
            }

            GetUserInfos(client);

            GetUsersInfos(client, new HashSet <long>()
            {
                99688848, 123456, 234567, 345678, 456789
            });

            Console.WriteLine("======== Test done =========");
        }
Пример #9
0
        static void Main(string[] args)
        {
            if (args.Length != 4)
            {
                Console.WriteLine("Usage: RTMGroups <rtm-endpoint> <projectId> <uid> <token>");
                return;
            }

            //-- Testing only
            // ManualInitForTesting();

            string rtmEndpoint = args[0];
            long   projectId   = Int64.Parse(args[1]);
            long   uid         = Int64.Parse(args[2]);
            string token       = args[3];

            RTMClient client = LoginRTM(rtmEndpoint, projectId, uid, token);

            if (client == null)
            {
                return;
            }

            Console.WriteLine("======== get group members =========");
            GetGroupMembers(client, groupId);

            Console.WriteLine("======== add group members =========");
            AddGroupMembers(client, groupId, new HashSet <long>()
            {
                99688868, 99688878, 99688888
            });

            Console.WriteLine("======== get group members =========");
            GetGroupMembers(client, groupId);

            Console.WriteLine("======== delete group members =========");
            DeleteGroupMembers(client, groupId, new HashSet <long>()
            {
                99688878
            });

            Console.WriteLine("======== get group members =========");
            GetGroupMembers(client, groupId);
            GetGroupMembersAndOnlineMembers(client, groupId);

            Console.WriteLine("======== get group member count =========");
            GetGroupMemberCount(client, groupId);
            GetGroupMemberCountWithOnlineMemberCount(client, groupId);


            Console.WriteLine("======== get self groups =========");
            GetSelfGroups(client);


            Console.WriteLine("======== set group infos =========");

            SetGroupInfos(client, groupId, "This is public info", "This is private info");
            GetGroupInfos(client, groupId);

            Console.WriteLine("======== change group infos =========");

            SetGroupInfos(client, groupId, "", "This is private info");
            GetGroupInfos(client, groupId);

            Console.WriteLine("======== change group infos =========");

            SetGroupInfos(client, groupId, "This is public info", "");
            GetGroupInfos(client, groupId);

            Console.WriteLine("======== only change the private infos =========");

            SetGroupInfos(client, groupId, null, "balabala");
            GetGroupInfos(client, groupId);

            SetGroupInfos(client, groupId, "This is public info", "This is private info");
            client.Bye();

            Console.WriteLine("======== user relogin =========");

            client = LoginRTM(rtmEndpoint, projectId, uid, token);

            if (client == null)
            {
                return;
            }

            GetGroupInfos(client, groupId);

            GetGroupsPublicInfo(client, new HashSet <long>()
            {
                223344, 334455, 445566, 667788, 778899
            });

            Console.WriteLine("======== Test done =========");
        }
Пример #10
0
        static void Main(string[] args)
        {
            if (args.Length != 4)
            {
                Console.WriteLine("Usage: RTMRooms <rtm-endpoint> <projectId> <uid> <token>");
                return;
            }

            //-- Testing only
            ManualInitForTesting();

            string rtmEndpoint = args[0];
            long   projectId   = Int64.Parse(args[1]);
            long   uid         = Int64.Parse(args[2]);
            string token       = args[3];

            RTMClient client = LoginRTM(rtmEndpoint, projectId, uid, token);

            if (client == null)
            {
                return;
            }

            Console.WriteLine("======== enter room =========");
            EnterRoom(client, roomId);

            Console.WriteLine("======== get self rooms =========");
            GetSelfRooms(client);

            Console.WriteLine("======== leave room =========");
            LeaveRoom(client, roomId);

            Console.WriteLine("======== get self rooms =========");
            GetSelfRooms(client);


            Console.WriteLine("======== enter room =========");
            EnterRoom(client, roomId);

            Console.WriteLine("======== set room infos =========");

            SetRoomInfos(client, roomId, "This is public info", "This is private info");
            GetRoomInfos(client, roomId);

            Console.WriteLine("======== change room infos =========");

            SetRoomInfos(client, roomId, "", "This is private info");
            GetRoomInfos(client, roomId);

            Console.WriteLine("======== change room infos =========");

            SetRoomInfos(client, roomId, "This is public info", "");
            GetRoomInfos(client, roomId);

            Console.WriteLine("======== only change the private infos =========");

            SetRoomInfos(client, roomId, null, "balabala");
            GetRoomInfos(client, roomId);

            SetRoomInfos(client, roomId, "This is public info", "This is private info");
            client.Bye();

            Console.WriteLine("======== user relogin =========");

            client = LoginRTM(rtmEndpoint, projectId, uid, token);

            if (client == null)
            {
                return;
            }

            Console.WriteLine("======== enter room =========");
            EnterRoom(client, roomId);

            GetRoomInfos(client, roomId);

            GetRoomsPublicInfo(client, new HashSet <long>()
            {
                556677, 778899, 445566, 334455, 1234
            });

            Console.WriteLine("======== get room members immediately =========");

            GetRoomMemberCount(client, new HashSet <long>()
            {
                roomId, 778899, 445566, 334455, 1234
            });
            GetRoomMembers(client, roomId);

            Console.WriteLine("======== get room members after 6 seconds =========");

            GetRoomMemberCount(client, new HashSet <long>()
            {
                roomId, 778899, 445566, 334455, 1234
            });
            GetRoomMembers(client, roomId);

            Console.WriteLine("======== Test done =========");
        }