From 91a20e0af7eb018ae222e11d5780757d7cebad2d Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Wed, 14 Oct 2020 14:49:53 +0200 Subject: [PATCH 1/5] set doctor of communication when doctor logs in --- ClientApp/Utils/DataParser.cs | 1 + DoctorApp/Utils/Client.cs | 2 +- DoctorApp/Utils/DataParser.cs | 16 ++++++++++ Server/Client.cs | 57 +++++++++++++++++++++-------------- Server/Communication.cs | 2 +- 5 files changed, 53 insertions(+), 25 deletions(-) diff --git a/ClientApp/Utils/DataParser.cs b/ClientApp/Utils/DataParser.cs index 6c1e4b7..44208b6 100644 --- a/ClientApp/Utils/DataParser.cs +++ b/ClientApp/Utils/DataParser.cs @@ -15,6 +15,7 @@ namespace ClientApp.Utils public const string START_SESSION = "START SESSION"; public const string STOP_SESSION = "STOP SESSION"; public const string SET_RESISTANCE = "SET RESISTANCE"; + public const string LOGIN_DOCTOR = "LOGIN DOCTOR"; /// /// makes the json object with LOGIN identifier and username and password /// diff --git a/DoctorApp/Utils/Client.cs b/DoctorApp/Utils/Client.cs index 9ce05b7..5ab73e3 100644 --- a/DoctorApp/Utils/Client.cs +++ b/DoctorApp/Utils/Client.cs @@ -236,7 +236,7 @@ namespace DoctorApp.Utils string hashUser = Hashing.Hasher.HashString(username); string hashPassword = Hashing.Hasher.HashString(password); - byte[] message = DataParser.getJsonMessage(DataParser.GetLoginJson(hashUser, hashPassword)); + byte[] message = DataParser.getJsonMessage(DataParser.LoginAsDoctor(hashUser, hashPassword)); this.stream.BeginWrite(message, 0, message.Length, new AsyncCallback(OnWrite), null); diff --git a/DoctorApp/Utils/DataParser.cs b/DoctorApp/Utils/DataParser.cs index ca7ca90..b46b993 100644 --- a/DoctorApp/Utils/DataParser.cs +++ b/DoctorApp/Utils/DataParser.cs @@ -17,6 +17,7 @@ namespace DoctorApp.Utils public const string SET_RESISTANCE = "SET RESISTANCE"; public const string NEW_CONNECTION = "NEW CONNECTION"; public const string DISCONNECT = "DISCONNECT"; + public const string LOGIN_DOCTOR = "LOGIN DOCTOR"; /// /// makes the json object with LOGIN identifier and username and password /// @@ -38,6 +39,21 @@ namespace DoctorApp.Utils return Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(json)); } + public static byte[] LoginAsDoctor(string mUsername, string mPassword) + { + dynamic json = new + { + identifier = LOGIN_DOCTOR, + data = new + { + username = mUsername, + password = mPassword, + } + }; + + return Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(json)); + } + public static bool GetUsernamePassword(byte[] jsonbytes, out string username, out string password) { dynamic json = JsonConvert.DeserializeObject(Encoding.ASCII.GetString(jsonbytes)); diff --git a/Server/Client.cs b/Server/Client.cs index ee32ef8..0da1408 100644 --- a/Server/Client.cs +++ b/Server/Client.cs @@ -4,6 +4,7 @@ using System.Net.Sockets; using System.Text; using Newtonsoft.Json; using ClientApp.Utils; +using System.Diagnostics; namespace Server { @@ -93,28 +94,12 @@ namespace Server switch (identifier) { case DataParser.LOGIN: - string username; - string password; - bool worked = DataParser.GetUsernamePassword(payloadbytes, out username, out password); - if (worked) - { - if (verifyLogin(username, password)) - { - Console.WriteLine("Log in"); - this.username = username; - sendMessage(DataParser.getLoginResponse("OK")); - sendMessage(DataParser.getStartSessionJson()); - communication.NewLogin(this); - } - else - { - sendMessage(DataParser.getLoginResponse("wrong username or password")); - } - } - else - { - sendMessage(DataParser.getLoginResponse("invalid json")); - } + handleLogin(payloadbytes); + break; + case DataParser.LOGIN_DOCTOR: + handleLogin(payloadbytes); + communication.doctor = this; + Console.WriteLine("Set doctor to " + communication.doctor + " , this is " + this); break; case DataParser.START_SESSION: this.saveData = new SaveData(Directory.GetCurrentDirectory() + "/" + this.username + "/" + sessionStart.ToString("yyyy-MM-dd HH-mm-ss")); @@ -123,7 +108,7 @@ namespace Server this.saveData = null; break; case DataParser.SET_RESISTANCE: - worked = DataParser.getResistanceFromResponseJson(payloadbytes); + bool worked = DataParser.getResistanceFromResponseJson(payloadbytes); Console.WriteLine($"set resistance worked is " + worked); //set resistance on doctor GUI break; @@ -159,6 +144,32 @@ namespace Server } + private void handleLogin(byte[] payloadbytes) + { + string username; + string password; + bool worked = DataParser.GetUsernamePassword(payloadbytes, out username, out password); + if (worked) + { + if (verifyLogin(username, password)) + { + Console.WriteLine("Log in"); + this.username = username; + sendMessage(DataParser.getLoginResponse("OK")); + sendMessage(DataParser.getStartSessionJson()); + communication.NewLogin(this); + } + else + { + sendMessage(DataParser.getLoginResponse("wrong username or password")); + } + } + else + { + sendMessage(DataParser.getLoginResponse("invalid json")); + } + } + public void sendMessage(byte[] message) { stream.BeginWrite(message, 0, message.Length, new AsyncCallback(OnWrite), null); diff --git a/Server/Communication.cs b/Server/Communication.cs index 31350ce..a8ff762 100644 --- a/Server/Communication.cs +++ b/Server/Communication.cs @@ -12,7 +12,7 @@ namespace Server { private TcpListener listener; private List clients; - private Client doctor; + public Client doctor; public Communication(TcpListener listener) { this.listener = listener; From 037d7732f75f669bd0e59c2438d3fd8c754f8afb Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Wed, 14 Oct 2020 14:55:31 +0200 Subject: [PATCH 2/5] changed name from hasher to util --- ClientApp/Utils/Client.cs | 2 +- DoctorApp/Utils/Client.cs | 6 +++--- Hashing/Hasher.cs | 2 +- Hashing/{Hashing.shproj => Util.shproj} | 0 ProftaakRH/ProftaakRH.sln | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) rename Hashing/{Hashing.shproj => Util.shproj} (100%) diff --git a/ClientApp/Utils/Client.cs b/ClientApp/Utils/Client.cs index d3f015c..5b869fa 100644 --- a/ClientApp/Utils/Client.cs +++ b/ClientApp/Utils/Client.cs @@ -266,7 +266,7 @@ namespace ClientApp.Utils public void tryLogin(string username, string password) { - string hashPassword = Hashing.Hasher.HashString(password); + string hashPassword = Util.Hasher.HashString(password); byte[] message = DataParser.getJsonMessage(DataParser.GetLoginJson(username, hashPassword)); diff --git a/DoctorApp/Utils/Client.cs b/DoctorApp/Utils/Client.cs index 5ab73e3..79c2fba 100644 --- a/DoctorApp/Utils/Client.cs +++ b/DoctorApp/Utils/Client.cs @@ -233,10 +233,10 @@ namespace DoctorApp.Utils /// public void tryLogin(string username, string password) { - string hashUser = Hashing.Hasher.HashString(username); - string hashPassword = Hashing.Hasher.HashString(password); + + string hashPassword = Util.Hasher.HashString(password); - byte[] message = DataParser.getJsonMessage(DataParser.LoginAsDoctor(hashUser, hashPassword)); + byte[] message = DataParser.getJsonMessage(DataParser.LoginAsDoctor(username, hashPassword)); this.stream.BeginWrite(message, 0, message.Length, new AsyncCallback(OnWrite), null); diff --git a/Hashing/Hasher.cs b/Hashing/Hasher.cs index 270faa3..b26eb24 100644 --- a/Hashing/Hasher.cs +++ b/Hashing/Hasher.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Security.Cryptography; using System.Text; -namespace Hashing +namespace Util { class Hasher { diff --git a/Hashing/Hashing.shproj b/Hashing/Util.shproj similarity index 100% rename from Hashing/Hashing.shproj rename to Hashing/Util.shproj diff --git a/ProftaakRH/ProftaakRH.sln b/ProftaakRH/ProftaakRH.sln index ce4248e..4d66ee3 100644 --- a/ProftaakRH/ProftaakRH.sln +++ b/ProftaakRH/ProftaakRH.sln @@ -5,7 +5,7 @@ VisualStudioVersion = 16.0.30413.136 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClientApp", "..\ClientApp\ClientApp.csproj", "{7EF854C1-73EB-4099-A7D7-057CCEEE6F8F}" EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Hashing", "..\Hashing\Hashing.shproj", "{70277749-D423-4871-B692-2EFC5A6ED932}" +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Util", "..\Hashing\Util.shproj", "{70277749-D423-4871-B692-2EFC5A6ED932}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProftaakRH", "ProftaakRH.csproj", "{C1A3CCE4-5FBB-4655-BFE1-7AF2B7D58CA3}" EndProject From c5c74a3d7a157aa9425ebc01f0604fd084ae224d Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Wed, 14 Oct 2020 14:59:00 +0200 Subject: [PATCH 3/5] moved dataparser to util --- ClientApp/Utils/Client.cs | 1 + ClientApp/Utils/DataParser.cs | 207 --------------------- DoctorApp/Utils/Client.cs | 1 + {DoctorApp/Utils => Hashing}/DataParser.cs | 2 +- Hashing/Hashing.projitems | 1 + Server/Client.cs | 1 + Server/Communication.cs | 1 + 7 files changed, 6 insertions(+), 208 deletions(-) delete mode 100644 ClientApp/Utils/DataParser.cs rename {DoctorApp/Utils => Hashing}/DataParser.cs (99%) diff --git a/ClientApp/Utils/Client.cs b/ClientApp/Utils/Client.cs index 5b869fa..16527fd 100644 --- a/ClientApp/Utils/Client.cs +++ b/ClientApp/Utils/Client.cs @@ -5,6 +5,7 @@ using System.Net.Sockets; using System.Text; using ClientApp.ViewModels; using ProftaakRH; +using Util; namespace ClientApp.Utils { diff --git a/ClientApp/Utils/DataParser.cs b/ClientApp/Utils/DataParser.cs deleted file mode 100644 index 44208b6..0000000 --- a/ClientApp/Utils/DataParser.cs +++ /dev/null @@ -1,207 +0,0 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; -using System; -using System.Globalization; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using System.Text; - -namespace ClientApp.Utils -{ - public class DataParser - { - public const string LOGIN = "LOGIN"; - public const string LOGIN_RESPONSE = "LOGIN RESPONSE"; - public const string START_SESSION = "START SESSION"; - public const string STOP_SESSION = "STOP SESSION"; - public const string SET_RESISTANCE = "SET RESISTANCE"; - public const string LOGIN_DOCTOR = "LOGIN DOCTOR"; - /// - /// makes the json object with LOGIN identifier and username and password - /// - /// username - /// password - /// json object to ASCII to bytes - public static byte[] GetLoginJson(string mUsername, string mPassword) - { - dynamic json = new - { - identifier = LOGIN, - data = new - { - username = mUsername, - password = mPassword, - } - }; - - return Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(json)); - } - - public static bool GetUsernamePassword(byte[] jsonbytes, out string username, out string password) - { - dynamic json = JsonConvert.DeserializeObject(Encoding.ASCII.GetString(jsonbytes)); - try - { - username = json.data.username; - password = json.data.password; - return true; - } - catch - { - username = null; - password = null; - return false; - } - } - - private static byte[] getJsonMessage(string mIdentifier, dynamic data) - { - dynamic json = new - { - identifier = mIdentifier, - data - }; - return getMessage(Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(json)), 0x01); - } - - private static byte[] getJsonMessage(string mIdentifier) - { - dynamic json = new - { - identifier = mIdentifier, - }; - return getMessage(Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(json)), 0x01); - } - - public static byte[] getLoginResponse(string mStatus) - { - return getJsonMessage(LOGIN_RESPONSE, new { status = mStatus }); - } - - public static string getResponseStatus(byte[] json) - { - return ((dynamic)JsonConvert.DeserializeObject(Encoding.ASCII.GetString(json))).data.status; - } - - /// - /// get the identifier from json - /// - /// json in ASCII - /// gets the identifier - /// if it sucseeded - public static bool getJsonIdentifier(byte[] bytes, out string identifier) - { - if (bytes.Length <= 5) - { - throw new ArgumentException("bytes to short"); - } - byte messageId = bytes[4]; - - if (messageId == 0x01) - { - dynamic json = JsonConvert.DeserializeObject(Encoding.ASCII.GetString(bytes.Skip(5).ToArray())); - identifier = json.identifier; - return true; - } - else - { - identifier = ""; - return false; - } - } - - /// - /// checks if the de message is raw data according to the protocol - /// - /// message - /// if message contains raw data - public static bool isRawData(byte[] bytes) - { - if (bytes.Length <= 5) - { - throw new ArgumentException("bytes to short"); - } - return bytes[4] == 0x02; - } - - /// - /// constructs a message with the payload, messageId and clientId - /// - /// - /// - /// - /// the message ready for sending - private static byte[] getMessage(byte[] payload, byte messageId) - { - byte[] res = new byte[payload.Length + 5]; - - Array.Copy(BitConverter.GetBytes(payload.Length + 5), 0, res, 0, 4); - res[4] = messageId; - Array.Copy(payload, 0, res, 5, payload.Length); - - return res; - } - - /// - /// constructs a message with the payload and clientId and assumes the payload is raw data - /// - /// - /// - /// the message ready for sending - public static byte[] GetRawDataMessage(byte[] payload) - { - return getMessage(payload, 0x02); - } - - /// - /// constructs a message with the payload and clientId and assumes the payload is json - /// - /// - /// - /// the message ready for sending - public static byte[] getJsonMessage(byte[] payload) - { - return getMessage(payload, 0x01); - } - - public static byte[] getStartSessionJson() - { - return getJsonMessage(START_SESSION); - } - - public static byte[] getStopSessionJson() - { - return getJsonMessage(STOP_SESSION); - } - - public static byte[] getSetResistanceJson(float mResistance) - { - dynamic data = new - { - resistance = mResistance - }; - return getJsonMessage(SET_RESISTANCE, data); - } - - public static byte[] getSetResistanceResponseJson(bool mWorked) - { - dynamic data = new - { - worked = mWorked - }; - return getJsonMessage(SET_RESISTANCE, data); - } - - public static float getResistanceFromJson(byte[] json) - { - return ((dynamic)JsonConvert.DeserializeObject(Encoding.ASCII.GetString(json))).data.resistance; - } - - public static bool getResistanceFromResponseJson(byte[] json) - { - return ((dynamic)JsonConvert.DeserializeObject(Encoding.ASCII.GetString(json))).data.worked; - } - - - } -} diff --git a/DoctorApp/Utils/Client.cs b/DoctorApp/Utils/Client.cs index 79c2fba..da77925 100644 --- a/DoctorApp/Utils/Client.cs +++ b/DoctorApp/Utils/Client.cs @@ -5,6 +5,7 @@ using System.Net.Sockets; using System.Text; using DoctorApp.ViewModels; using ProftaakRH; +using Util; namespace DoctorApp.Utils { diff --git a/DoctorApp/Utils/DataParser.cs b/Hashing/DataParser.cs similarity index 99% rename from DoctorApp/Utils/DataParser.cs rename to Hashing/DataParser.cs index b46b993..9403bdb 100644 --- a/DoctorApp/Utils/DataParser.cs +++ b/Hashing/DataParser.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using System.Text; -namespace DoctorApp.Utils +namespace Util { public class DataParser { diff --git a/Hashing/Hashing.projitems b/Hashing/Hashing.projitems index 127b36a..73a08de 100644 --- a/Hashing/Hashing.projitems +++ b/Hashing/Hashing.projitems @@ -9,6 +9,7 @@ Hashing + \ No newline at end of file diff --git a/Server/Client.cs b/Server/Client.cs index 0da1408..092fe70 100644 --- a/Server/Client.cs +++ b/Server/Client.cs @@ -5,6 +5,7 @@ using System.Text; using Newtonsoft.Json; using ClientApp.Utils; using System.Diagnostics; +using Util; namespace Server { diff --git a/Server/Communication.cs b/Server/Communication.cs index a8ff762..ab956c9 100644 --- a/Server/Communication.cs +++ b/Server/Communication.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Net.Sockets; using System.Text; using DoctorApp.Utils; +using Util; namespace Server { From 11ebc67c13ae2dbf33c90e9fd9c2c8c24a279d4c Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Wed, 14 Oct 2020 15:01:13 +0200 Subject: [PATCH 4/5] moved observableobject to util --- ClientApp/Models/Info.cs | 1 + ClientApp/ViewModels/LoginViewModel.cs | 1 + ClientApp/ViewModels/MainViewModel.cs | 1 + ClientApp/ViewModels/MainWindowViewModel.cs | 1 + DoctorApp/Models/Info.cs | 1 + DoctorApp/Utils/ObservableObject.cs | 12 ------------ DoctorApp/ViewModels/LoginViewModel.cs | 1 + DoctorApp/ViewModels/MainViewModel.cs | 1 + DoctorApp/ViewModels/MainWindowViewModel.cs | 1 + Hashing/Hashing.projitems | 1 + {ClientApp/Utils => Hashing}/ObservableObject.cs | 2 +- 11 files changed, 10 insertions(+), 13 deletions(-) delete mode 100644 DoctorApp/Utils/ObservableObject.cs rename {ClientApp/Utils => Hashing}/ObservableObject.cs (90%) diff --git a/ClientApp/Models/Info.cs b/ClientApp/Models/Info.cs index 350d6e8..262032d 100644 --- a/ClientApp/Models/Info.cs +++ b/ClientApp/Models/Info.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Text; +using Util; namespace ClientApp.Models { diff --git a/ClientApp/ViewModels/LoginViewModel.cs b/ClientApp/ViewModels/LoginViewModel.cs index 7adccd1..1179ec2 100644 --- a/ClientApp/ViewModels/LoginViewModel.cs +++ b/ClientApp/ViewModels/LoginViewModel.cs @@ -7,6 +7,7 @@ using System.Windows.Controls; using System.Windows.Input; using ClientApp.Utils; using GalaSoft.MvvmLight.Command; +using Util; namespace ClientApp.ViewModels { diff --git a/ClientApp/ViewModels/MainViewModel.cs b/ClientApp/ViewModels/MainViewModel.cs index 58252e1..0e5d601 100644 --- a/ClientApp/ViewModels/MainViewModel.cs +++ b/ClientApp/ViewModels/MainViewModel.cs @@ -3,6 +3,7 @@ using ClientApp.Utils; using GalaSoft.MvvmLight.Command; using System.Diagnostics; using System.Windows.Input; +using Util; namespace ClientApp.ViewModels { diff --git a/ClientApp/ViewModels/MainWindowViewModel.cs b/ClientApp/ViewModels/MainWindowViewModel.cs index f30bf73..2061ccf 100644 --- a/ClientApp/ViewModels/MainWindowViewModel.cs +++ b/ClientApp/ViewModels/MainWindowViewModel.cs @@ -3,6 +3,7 @@ using ClientApp.Utils; using System; using System.Collections.Generic; using System.Text; +using Util; namespace ClientApp.ViewModels { diff --git a/DoctorApp/Models/Info.cs b/DoctorApp/Models/Info.cs index 4c195ca..0d39258 100644 --- a/DoctorApp/Models/Info.cs +++ b/DoctorApp/Models/Info.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Text; +using Util; namespace DoctorApp.Models { diff --git a/DoctorApp/Utils/ObservableObject.cs b/DoctorApp/Utils/ObservableObject.cs deleted file mode 100644 index 9b35f60..0000000 --- a/DoctorApp/Utils/ObservableObject.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Text; - -namespace DoctorApp.Utils -{ - public abstract class ObservableObject : INotifyPropertyChanged - { - public event PropertyChangedEventHandler PropertyChanged; - } -} diff --git a/DoctorApp/ViewModels/LoginViewModel.cs b/DoctorApp/ViewModels/LoginViewModel.cs index a8e26ae..1c9e18a 100644 --- a/DoctorApp/ViewModels/LoginViewModel.cs +++ b/DoctorApp/ViewModels/LoginViewModel.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Text; using System.Windows.Controls; using System.Windows.Input; +using Util; namespace DoctorApp.ViewModels { diff --git a/DoctorApp/ViewModels/MainViewModel.cs b/DoctorApp/ViewModels/MainViewModel.cs index 27c8e69..2b34b32 100644 --- a/DoctorApp/ViewModels/MainViewModel.cs +++ b/DoctorApp/ViewModels/MainViewModel.cs @@ -5,6 +5,7 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.Text; using System.Windows.Controls; +using Util; namespace DoctorApp.ViewModels { diff --git a/DoctorApp/ViewModels/MainWindowViewModel.cs b/DoctorApp/ViewModels/MainWindowViewModel.cs index 7b41840..fa7a982 100644 --- a/DoctorApp/ViewModels/MainWindowViewModel.cs +++ b/DoctorApp/ViewModels/MainWindowViewModel.cs @@ -3,6 +3,7 @@ using DoctorApp.Utils; using System; using System.Collections.Generic; using System.Text; +using Util; namespace DoctorApp.ViewModels { diff --git a/Hashing/Hashing.projitems b/Hashing/Hashing.projitems index 73a08de..a81b09e 100644 --- a/Hashing/Hashing.projitems +++ b/Hashing/Hashing.projitems @@ -11,5 +11,6 @@ + \ No newline at end of file diff --git a/ClientApp/Utils/ObservableObject.cs b/Hashing/ObservableObject.cs similarity index 90% rename from ClientApp/Utils/ObservableObject.cs rename to Hashing/ObservableObject.cs index 3809fa1..c56ec0c 100644 --- a/ClientApp/Utils/ObservableObject.cs +++ b/Hashing/ObservableObject.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Text; -namespace ClientApp.Utils +namespace Util { public abstract class ObservableObject : INotifyPropertyChanged { From ea4093ff75412bb5a157cf9b35b5d12eb67e4319 Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Wed, 14 Oct 2020 15:19:20 +0200 Subject: [PATCH 5/5] added message to dataparser --- Hashing/DataParser.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Hashing/DataParser.cs b/Hashing/DataParser.cs index 9403bdb..1ba0581 100644 --- a/Hashing/DataParser.cs +++ b/Hashing/DataParser.cs @@ -18,6 +18,7 @@ namespace Util public const string NEW_CONNECTION = "NEW CONNECTION"; public const string DISCONNECT = "DISCONNECT"; public const string LOGIN_DOCTOR = "LOGIN DOCTOR"; + public const string MESSAGE = "MESSAGE"; /// /// makes the json object with LOGIN identifier and username and password ///