[ADDITION] servercommunication towards the client.
Still in progress not functional because of a null exception when receiving the broadcast message.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SharedClientServer;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -16,6 +17,7 @@ namespace Server.Models
|
||||
private byte[] totalBuffer = new byte[1024];
|
||||
private int totalBufferReceived = 0;
|
||||
public User User { get; set; }
|
||||
private ServerCommunication serverCom = ServerCommunication.INSTANCE;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -116,7 +118,17 @@ namespace Server.Models
|
||||
string textUsername = combo.Item1;
|
||||
string textMsg = combo.Item2;
|
||||
|
||||
Debug.WriteLine("[SERVERCLIENT] User name: {0}\t User message: {1}", textUsername, textMsg);
|
||||
|
||||
dynamic dataPacket = new
|
||||
{
|
||||
username = textUsername,
|
||||
message = textMsg
|
||||
};
|
||||
|
||||
// todo handle sending to all except this user the username and message to display in chat
|
||||
//serverCom.SendToAllExcept();
|
||||
serverCom.sendToAll(JSONConvert.GetMessageToSend(JSONConvert.MESSAGE, dataPacket));
|
||||
break;
|
||||
|
||||
case JSONConvert.LOBBY:
|
||||
|
||||
Reference in New Issue
Block a user