I have a connection with a Node.JS server. Sending empty messages works fine. receiving messages from the server also works fine. However, when I try to send some additional data with the EmitAsync function, it does not register anything. There is no exception thrown or anything of this nature; the server just does not receive a message.
This is my code::
public void SendDataPacket(DataPacket dataPacket)
{
//if the client is connected, send the dataPacket. If not, add it to the queue to be sent at a later time.
if (client.Connected)
{
string data = dataPacket.ToJson();
byte[] bytes = Encoding.ASCII.GetBytes(data);
//None of these calls are registered on the server side.
client.EmitAsync(dataPacket.EventName, bytes);
client.EmitAsync(dataPacket.EventName, data);
client.EmitAsync(dataPacket.EventName, dataPacket);
//This works fine.
client.EmitAsync(dataPacket.EventName);
} else
{
dataPackets.Enqueue(dataPacket);
}
}
I already checked that the object in question can be serialized. Sending an empty string also does not work.
I have a connection with a Node.JS server. Sending empty messages works fine. receiving messages from the server also works fine. However, when I try to send some additional data with the EmitAsync function, it does not register anything. There is no exception thrown or anything of this nature; the server just does not receive a message.
This is my code::
I already checked that the object in question can be serialized. Sending an empty string also does not work.
On the back end side, this is my Javascript code
Debugging either instance does not resolve in any meaningful errors or other casuses for this problem. Any help is greatly appreciated.