private void parseMessage(string message) { try { if (message.IndexOf("{") > -1) { message = message.Substring(message.IndexOf("{")); } SocketMessage json = JsonConvert.DeserializeObject <SocketMessage>(message); if (json.name == "log" && userid == null) { userid = json.args[0].user; Console.WriteLine("Got user id: " + userid); } string questionid = json.args[0].qid; string question = json.args[0].question; string answer = json.args[0].answer; double endtime = json.args[0].end_time; QuestionEventArgs q = new QuestionEventArgs(questionid, question, answer, endtime); if (!q.Equals(lastq) && !q.isEmpty()) { lastq = q; OnQuestionEvent?.Invoke(this, q); } } catch (Exception e) { } }