예제 #1
0
        /// <inheritdoc cref="LeaveChatAsync(string)"/>
        public Task LeaveChatAsync(string channelId)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid          = $"{_cid++}",
                ChannelLeave = new ChannelLeaveMessage
                {
                    ChannelId = channelId
                }
            };

            return(SendAsync(envelope));
        }
예제 #2
0
        /// <inheritdoc cref="LeaveMatchAsync(string)"/>
        public Task LeaveMatchAsync(string matchId)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid        = $"{_cid++}",
                MatchLeave = new MatchLeaveMessage
                {
                    MatchId = matchId
                }
            };

            return(SendAsync(envelope));
        }
예제 #3
0
        /// <inheritdoc cref="UpdateStatusAsync"/>
        public Task UpdateStatusAsync(string status)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid          = $"{_cid++}",
                StatusUpdate = new StatusUpdateMessage
                {
                    Status = status
                }
            };

            return(SendAsync(envelope));
        }
예제 #4
0
        /// <inheritdoc />
        public async Task UpdateStatusAsync(string status)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid          = Guid.NewGuid().ToString(),
                StatusUpdate = new StatusUpdateMessage
                {
                    Status = status
                }
            };

            await SendAsync(envelope);
        }
예제 #5
0
        /// <inheritdoc />
        public async Task UnfollowUsersAsync(IEnumerable <string> userIds)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid            = Guid.NewGuid().ToString(),
                StatusUnfollow = new StatusUnfollowMessage
                {
                    UserIds = new List <string>(userIds)
                }
            };

            await SendAsync(envelope);
        }
예제 #6
0
        /// <inheritdoc cref="RemoveMatchmakerAsync(string)"/>
        public Task RemoveMatchmakerAsync(string ticket)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid = $"{_cid++}",
                MatchmakerRemove = new MatchmakerRemoveMessage
                {
                    Ticket = ticket
                }
            };

            return(SendAsync(envelope));
        }
예제 #7
0
        /// <inheritdoc cref="UnfollowUsersAsync(System.Collections.Generic.IEnumerable{string})"/>
        public Task UnfollowUsersAsync(IEnumerable <string> userIDs)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid            = $"{_cid++}",
                StatusUnfollow = new StatusUnfollowMessage
                {
                    UserIds = new List <string>(userIDs)
                }
            };

            return(SendAsync(envelope));
        }
예제 #8
0
        /// <inheritdoc />
        public async Task LeaveMatchAsync(string matchId)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid        = Guid.NewGuid().ToString(),
                MatchLeave = new MatchLeaveMessage
                {
                    MatchId = matchId
                }
            };

            await SendAsync(envelope).ConfigureAwait(false);
        }
예제 #9
0
        /// <inheritdoc />
        public async Task RemoveMatchmakerAsync(string ticket)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid = Guid.NewGuid().ToString(),
                MatchmakerRemove = new MatchmakerRemoveMessage
                {
                    Ticket = ticket
                }
            };

            await SendAsync(envelope).ConfigureAwait(false);
        }
예제 #10
0
        /// <inheritdoc cref="UpdateStatusAsync"/>
        public Task UpdateStatusAsync(string status)
        {
            int cid      = Interlocked.Increment(ref _cid);
            var envelope = new WebSocketMessageEnvelope
            {
                Cid          = $"{cid}",
                StatusUpdate = new StatusUpdateMessage
                {
                    Status = status
                }
            };

            return(SendAsync(envelope));
        }
예제 #11
0
        /// <inheritdoc cref="SendPartyDataAsync(string,long,ArraySegment{byte})"/>
        public Task SendPartyDataAsync(string partyId, long opCode, ArraySegment <byte> data)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                PartyDataSend = new PartyDataSend
                {
                    PartyId = partyId,
                    OpCode  = Convert.ToString(opCode),
                    Data    = Convert.ToBase64String(data.Array, data.Offset, data.Count)
                }
            };

            return(SendAsync(envelope));
        }
예제 #12
0
        /// <inheritdoc cref="SendPartyDataAsync(string,long,byte[])"/>
        public Task SendPartyDataAsync(string partyId, long opCode, byte[] data)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                PartyDataSend = new PartyDataSend
                {
                    PartyId = partyId,
                    OpCode  = Convert.ToString(opCode),
                    Data    = Convert.ToBase64String(data)
                }
            };

            return(SendAsync(envelope));
        }
예제 #13
0
        /// <inheritdoc cref="RemoveMatchmakerAsync(string)"/>
        public Task RemoveMatchmakerAsync(string ticket)
        {
            int cid      = Interlocked.Increment(ref _cid);
            var envelope = new WebSocketMessageEnvelope
            {
                Cid = $"{cid}",
                MatchmakerRemove = new MatchmakerRemoveMessage
                {
                    Ticket = ticket
                }
            };

            return(SendAsync(envelope));
        }
예제 #14
0
        /// <inheritdoc cref="LeavePartyAsync"/>
        public Task LeavePartyAsync(string partyId)
        {
            int cid      = Interlocked.Increment(ref _cid);
            var envelope = new WebSocketMessageEnvelope
            {
                Cid        = $"{cid}",
                PartyLeave = new PartyLeave
                {
                    PartyId = partyId
                }
            };

            return(SendAsync(envelope));
        }
예제 #15
0
        /// <inheritdoc />
        public async Task <IMatch> JoinMatchAsync(string matchId)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid       = Guid.NewGuid().ToString(),
                MatchJoin = new MatchJoinMessage
                {
                    MatchId = matchId
                }
            };
            var response = await SendAsync(envelope).ConfigureAwait(false);

            return(response.Match);
        }
예제 #16
0
        /// <inheritdoc="RemoveMatchmakerPartyAsync"/>
        public Task RemoveMatchmakerPartyAsync(string partyId, string ticket)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid = $"{_cid++}",
                PartyMatchmakerRemove = new PartyMatchmakerRemove
                {
                    PartyId = partyId,
                    Ticket  = ticket
                }
            };

            return(SendAsync(envelope));
        }
예제 #17
0
        /// <inheritdoc cref="AcceptPartyMemberAsync"/>
        public Task AcceptPartyMemberAsync(string partyId, IUserPresence presence)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid         = $"{_cid++}",
                PartyAccept = new PartyAccept
                {
                    PartyId  = partyId,
                    Presence = presence as UserPresence // TODO serialize interface directly in protobuf
                }
            };

            return(SendAsync(envelope));
        }
예제 #18
0
        /// <inheritdoc cref="PromotePartyMember"/>
        public Task PromotePartyMember(string partyId, IUserPresence partyMember)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid          = $"{_cid++}",
                PartyPromote = new PartyPromote
                {
                    PartyId  = partyId,
                    Presence = partyMember as UserPresence // TODO serialize interface directly in protobuf
                }
            };

            return(SendAsync(envelope));
        }
예제 #19
0
        /// <inheritdoc cref="LeaveChatAsync(string)"/>
        public Task LeaveChatAsync(string channelId)
        {
            int cid      = Interlocked.Increment(ref _cid);
            var envelope = new WebSocketMessageEnvelope
            {
                Cid          = $"{cid}",
                ChannelLeave = new ChannelLeaveMessage
                {
                    ChannelId = channelId
                }
            };

            return(SendAsync(envelope));
        }
예제 #20
0
        /// <inheritdoc="RemovePartyMemberAsync"/>
        public Task RemovePartyMemberAsync(string partyId, IUserPresence presence)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid = $"{_cid++}",
                PartyMemberRemove = new PartyMemberRemove
                {
                    PartyId  = partyId,
                    Presence = presence as UserPresence
                }
            };

            return(SendAsync(envelope));
        }
예제 #21
0
        /// <inheritdoc cref="LeaveMatchAsync(string)"/>
        public Task LeaveMatchAsync(string matchId)
        {
            int cid      = Interlocked.Increment(ref _cid);
            var envelope = new WebSocketMessageEnvelope
            {
                Cid        = $"{cid}",
                MatchLeave = new MatchLeaveMessage
                {
                    MatchId = matchId
                }
            };

            return(SendAsync(envelope));
        }
예제 #22
0
        /// <inheritdoc cref="UnfollowUsersAsync(System.Collections.Generic.IEnumerable{string})"/>
        public Task UnfollowUsersAsync(IEnumerable <string> userIDs)
        {
            int cid      = Interlocked.Increment(ref _cid);
            var envelope = new WebSocketMessageEnvelope
            {
                Cid            = $"{cid}",
                StatusUnfollow = new StatusUnfollowMessage
                {
                    UserIds = new List <string>(userIDs)
                }
            };

            return(SendAsync(envelope));
        }
예제 #23
0
        /// <inheritdoc cref="JoinMatchAsync(string)"/>
        public async Task <IMatch> JoinMatchAsync(string matchId)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid       = $"{_cid++}",
                MatchJoin = new MatchJoinMessage
                {
                    MatchId = matchId
                }
            };
            var response = await SendAsync(envelope);

            return(response.Match);
        }
예제 #24
0
        /// <inheritdoc cref="FollowUsersAsync(System.Collections.Generic.IEnumerable{string})"/>
        public async Task <IStatus> FollowUsersAsync(IEnumerable <string> userIDs)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid          = $"{_cid++}",
                StatusFollow = new StatusFollowMessage
                {
                    UserIds = new List <string>(userIDs)
                }
            };
            var response = await SendAsync(envelope);

            return(response.Status);
        }
예제 #25
0
        /// <inheritdoc cref="WriteChatMessageAsync(string,string)"/>
        public async Task <IChannelMessageAck> WriteChatMessageAsync(string channelId, string content)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid = $"{_cid++}",
                ChannelMessageSend = new ChannelSendMessage
                {
                    ChannelId = channelId,
                    Content   = content
                }
            };
            var response = await SendAsync(envelope);

            return(response.ChannelMessageAck);
        }
예제 #26
0
        /// <inheritdoc cref="RpcAsync"/>
        public async Task <IApiRpc> RpcAsync(string funcId, string payload = null)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid = $"{_cid++}",
                Rpc = new ApiRpc
                {
                    Id      = funcId,
                    Payload = payload
                }
            };
            var response = await SendAsync(envelope);

            return(response.Rpc);
        }
예제 #27
0
        /// <inheritdoc cref="RemoveChatMessageAsync(string,string)"/>
        public async Task <IChannelMessageAck> RemoveChatMessageAsync(string channelId, string messageId)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid = $"{_cid++}",
                ChannelMessageRemove = new ChannelRemoveMessage
                {
                    ChannelId = channelId,
                    MessageId = messageId
                }
            };
            var response = await SendAsync(envelope);

            return(response.ChannelMessageAck);
        }
예제 #28
0
        /// <inheritdoc cref="JoinMatchAsync(string,IDictionary{string, string})"/>
        public async Task <IMatch> JoinMatchAsync(string matchId, IDictionary <string, string> metadata = null)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid       = $"{_cid++}",
                MatchJoin = new MatchJoinMessage
                {
                    MatchId  = matchId,
                    Metadata = metadata
                }
            };
            var response = await SendAsync(envelope);

            return(response.Match);
        }
예제 #29
0
        /// <inheritdoc />
        public async Task <IChannelMessageAck> WriteChatMessageAsync(string channelId, string content)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid = Guid.NewGuid().ToString(),
                ChannelMessageSend = new ChannelSendMessage
                {
                    ChannelId = channelId,
                    Content   = content
                }
            };
            var response = await SendAsync(envelope).ConfigureAwait(false);

            return(response.ChannelMessageAck);
        }
예제 #30
0
        /// <inheritdoc />
        public async Task <IApiRpc> RpcAsync(string id, string content)
        {
            var envelope = new WebSocketMessageEnvelope
            {
                Cid = Guid.NewGuid().ToString(),
                Rpc = new ApiRpc
                {
                    Id      = id,
                    Payload = content
                }
            };
            var response = await SendAsync(envelope).ConfigureAwait(false);

            return(response.Rpc);
        }