public Token PacketToToken(WebSocketPacket aPacket) { var byteArray = aPacket.GetByteArray(); var packetString = WebSocketConvert.BytesToString(byteArray, WebSocketTypeEncoding.UTF8); var dictionary = JsonConvert.DeserializeObject <Dictionary <string, object> >(packetString); var dictionaryToken = new DictionaryToken(); dictionaryToken.SetDictionary(dictionary); return(dictionaryToken); }