Esempio n. 1
0
        private void SendPing()
        {
            var pingPacket = new GoodgamePacket()
            {
                Type = "ping",
                Data = new GoodGameData()
                {
                }
            };

            webSocket.Send(pingPacket.ToString());
        }
Esempio n. 2
0
        private void RequestCounters()
        {
            var channelId     = (Chat as GoodgameChat).GetChannelId(ChannelName);
            var counterPacket = new GoodgamePacket()
            {
                Type = "get_channel_counters",
                Data = new GoodGameData()
                {
                    ChannelId = channelId
                },
            };

            if (counterPacket != null && counterPacket.Data != null)
            {
                //Log.WriteInfo("Goodgame sending {0}", counterPacket.ToString());
                webSocket.Send(counterPacket.ToString());
            }
        }
Esempio n. 3
0
        private void SendCredentials()
        {
            uint userId = 0;

            UInt32.TryParse(Chat.Config.GetParameterValue("UserId").ToString(), out userId);
            var authPacket = new GoodgamePacket()
            {
                Type = "auth",
                Data = new GoodGameData()
                {
                    UserId = userId,
                    Token  = this.With(x => Chat.Config.GetParameterValue("ChatToken")).With(x => x.ToString()),
                },
            };

            //Log.WriteInfo("Goodgame sending {0}", authPacket.ToString());
            webSocket.Send(authPacket.ToString());
        }
Esempio n. 4
0
        private void SendChannelJoin()
        {
            var channelId = (Chat as GoodgameChat).GetChannelId(ChannelName);
            //Log.WriteInfo("Goodgame serializing join packet. ChannelId: {0}", channelId);
            var joinPacket = new GoodgamePacket()
            {
                Type = "join",
                Data = new GoodGameData()
                {
                    ChannelId = channelId,
                    IsHidden  = false,
                    Mobile    = 0,
                },
            };

            if (joinPacket != null && joinPacket.Data != null)
            {
                //Log.WriteInfo("Goodgame sending {0}", joinPacket.ToString());
                webSocket.Send(joinPacket.ToString());
            }
        }
Esempio n. 5
0
        public override void SendMessage(ChatMessage message)
        {
            if (Chat.IsAnonymous || String.IsNullOrWhiteSpace(message.Channel) ||
                String.IsNullOrWhiteSpace(message.FromUserName) ||
                String.IsNullOrWhiteSpace(message.Text))
            {
                return;
            }
            //["{\"type\":\"send_message\",\"data\":{\"channel_id\":2304,\"text\":\"asdf\",\"hideIcon\":false,\"mobile\":0}}"]
            var channelId     = (Chat as GoodgameChat).GetChannelId(ChannelName);
            var messagePacket = new GoodgamePacket()
            {
                Type = "send_message",
                Data = new GoodGameData()
                {
                    ChannelId    = channelId,
                    Text         = message.Text,
                    IsIconHidden = false,
                    Mobile       = 0,
                }
            };

            webSocket.Send(messagePacket.ToString());
        }