Fixed json formatting in SendMessage
This commit is contained in:
committed by
Felix Hartmann (PEA3-Fe-FI)
parent
05e3e9e0c4
commit
b42a2f9728
@@ -42,7 +42,7 @@ namespace PolyChat
|
||||
|
||||
private void Serve()
|
||||
{
|
||||
Debug.WriteLine("! SERVER STARTING !");
|
||||
Debug.WriteLine("--- Controller.Serve ---");
|
||||
SocketIOServer server = new SocketIOServer(new SocketIOServerOption(
|
||||
PORT
|
||||
));
|
||||
@@ -69,9 +69,12 @@ namespace PolyChat
|
||||
{
|
||||
Debug.WriteLine("--- Controller.SendMessage ---");
|
||||
Debug.WriteLine($"{type} -> {ip} content: {content}");
|
||||
string json = $"{{ type: {type}, content: {content} }}";
|
||||
Debug.WriteLine($"json: {json}");
|
||||
Connections[ip].SendMessage(json);
|
||||
JObject json = new JObject(
|
||||
new JProperty("type", type),
|
||||
new JProperty("content", content)
|
||||
);
|
||||
Debug.WriteLine($"json: {json.ToString()}");
|
||||
Connections[ip].SendMessage(json.ToString());
|
||||
}
|
||||
|
||||
private void OnMessage(string ip, JToken[] data)
|
||||
|
||||
Reference in New Issue
Block a user