Esempio n. 1
0
        public void SendChatMessage(string message)
        {
            GhLiveMessage messageObj = new GhLiveMessage();

            messageObj.Sender  = _id;
            messageObj.Message = message;

            string stuff = Newtonsoft.Json.JsonConvert.SerializeObject(messageObj);

            socket.Emit("update", stuff);
        }
Esempio n. 2
0
        public void SendUpdateMessage(string compType, Guid customId, GhLivePoint position, UpdateType type)
        {
            GhLiveMessage messageObj = new GhLiveMessage();

            messageObj.Type       = compType;
            messageObj.CustomId   = customId;
            messageObj.Point      = position;
            messageObj.UpdateType = type;
            messageObj.Sender     = _id;

            string stuff = Newtonsoft.Json.JsonConvert.SerializeObject(messageObj);

            socket.Emit("update", stuff);
        }
Esempio n. 3
0
        protected virtual void OnMessageReceived(string message)
        {
            try
            {
                GhLiveMessage incomingObj = Newtonsoft.Json.JsonConvert.DeserializeObject <GhLiveMessage>(message);

                if (incomingObj.Sender != _id)
                {
                    GhLiveEventArgs e = new GhLiveEventArgs();
                    e.TheObject = incomingObj;
                    var handler = this.DataReceived;

                    if (handler != null)
                    {
                        handler(this, e);
                    }
                    //Console.WriteLine(incomingObj.Message);
                }
            }
            catch (Exception)
            {
                //throw;
            }
        }