Server Chat example
Options
Hello,
I have been trying to follow the simple chat server from the "An App From Scratch" example.
I am using Visual Studio 2015, with .Net 4.6, 4.5.1 and 4.5.
I am currently having the problem where the OnEvent(EventData eventData) method in my ChatClient.cs does not seem to get called whenever I type out and send a message. Therefore, I do not see any sent messages on the clients.
Any help appreciated.
Thank you very much and best regards.
I have been trying to follow the simple chat server from the "An App From Scratch" example.
I am using Visual Studio 2015, with .Net 4.6, 4.5.1 and 4.5.
I am currently having the problem where the OnEvent(EventData eventData) method in my ChatClient.cs does not seem to get called whenever I type out and send a message. Therefore, I do not see any sent messages on the clients.
Any help appreciated.
Thank you very much and best regards.
0
Comments
-
Hi, @Valkyri1971
how many client peers you have connected to server?
do you call on client method Service?
best,
ilya0 -
Hello,
I have only 1 client connected to server.
I copied the code from:
https://doc.photonengine.com/en-us/onpremise/current/app-framework/an-app-from-scratch
For the ChatClient. "peer.Service()" is called in the UpdateLoop() function.
Regards.
P.S.: Also, tried running 2 instances of the client on the same machine. No messages get sent across.0 -
Hello,
I managed to get it to work.
The problem was this code in ChatPeer:
private void OnBroadcastMessage(ChatPeer peer, EventData eventData, SendParameters sendParameters)
{
if (peer != this) // do not send chat custom event to peer who called the chat custom operation
{
SendEvent(eventData, sendParameters);
}
}
It worked when I commented out the if statement.
Thank you and best regards.0 -
yeah, this is because you have only one client connection. this sample supposed to work with two
best
ilya0