OnPublicMessage callback is not working.

Post here all your questions related with SmartFoxServer .Net/Unity3D API

Moderators: Lapo, Bax

Posts: 9
Joined: 25 Aug 2011, 08:25

OnPublicMessage callback is not working.

Postby pankaj454k » 25 Aug 2011, 08:48

I m working on one Facebook game where i m using Unity. I am facing one problem to implementing chat. OnPublicMessage callback is not calling when i m sending msg to server.
Below code:

_smartFox.AddEventListener(SFSEvent.PUBLIC_MESSAGE, OnPublicMessage);

public void OnPublicMessage(BaseEvent evt)
print("Chat message received");
public void OnChatMessage(string newMessage)
print("sending chat message " + newMessage);
_smartFox.Send(new PublicMessageRequest("Hello Everyone"));
Here I am calling OnChatMessage method as per my need.
Now my problem is OnPublicMessage has to call after sending msg to server but "OnPublicMessage" callback is not working. I have seen your given example. And I did exactly same but i don't know where m i doing mistake. Server side i can see the msg like "GenericMessage" when i type something on press enter. That means something happening there.
Please suggest me. I m facing this problem from last two days.
Posts: 9
Joined: 25 Aug 2011, 08:25

Postby pankaj454k » 25 Aug 2011, 11:17

Now it is working. I was doing some mistake.
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 25 Aug 2011, 11:19

Hi - this seems to be a SFS2X issue, right? This part of the forum is for the old SFS1.

But anyways - code looks good enough to me. The callbacks definitely work as you can see from the examples you also ran.

Some suggestions:
Do you remember to process the queue in a e.g. FixedUpdate()?
Can you log in and all the other stuff?
Are you joined in a room?

Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund

Return to “.Net / Unity3D API”

Who is online

Users browsing this forum: No registered users and 2 guests