can i get Private chat history ?
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on Photon Chat.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
can i get Private chat history ?
sonal_dhole2
2019-03-15 07:23:13
hello,
i need to private chat history in photon chat.
Is this possible? if yes then how and if no then why ?
please help me if any one have idea.
thank you.
Comments
Hi @sonal_dhole2,
Where do you need the private chat history?
In client side or in chat webhooks?
What do you need the chat history for?
If user A sends private message(s) to user B while user B is disconnected, user B will receive the last X messages once connected as long as user A is still connected.
I think X is 100, it's the maximum history size per channel (private or public).
If this is not what you are looking for, you can always use public channels as "private channels": use special channel name (e.g. "
sonal_dhole2
2019-03-19 11:35:05
i need private chat history in my room.
e.g. if two player A and B coming to single room and doing chat, after that player B left the room and again join the same room ,then i need the previous private chat of them.
is this possible ?
Hi @sonal_dhole2,
Photon Chat has channels and does not have rooms.
Rooms are available in PUN or Photon Realtime.
The server keeps the last 100 messages exchanged per channel as long as player A or player B stay connected to Photon Chat.
The client API or SDK may cache the messages locally for more than 100 messages.
You can get those using:
string privateChannelName = chatClient.GetPrivateChannelNameByUser(remoteUser);
ChatChannel privateChannel;
if (chatClient.TryGetChannel(privateChannelName, true, out privateChannel))
{
List
sonal_dhole2
2019-04-09 11:17:19
i can't able to get private chat channel
chatClient.TryGetChannel(privateChannelName, true, out privateChannel)
at this point.
Hi @sonal_dhole2,
This probably means that the client did not receive any message from that user.
sonal_dhole2
2019-04-18 06:34:25
but in this method
public void OnPrivateMessage(string sender, object message, String channelName)
it receives the message then how can it possible?
Hi @sonal_dhole2,
When are you using the code snippet?
At which point?
sonal_dhole2
2019-04-22 07:29:04
Is the sender equal the local UserId?
it receives messages from both if the sender is a local user or another one.
are you receiving your own message?
receive messages of both of them who are in private chat.
my scenario is that
I am connected to chat client -----> chat with person as private chat -----> now I am disconnecting from chatclient ----> again connect to chat client and come online ------> at that time I can't get private chat history of with that person.
Hi @sonal_dhole2,
In file "Assets\Photon\PhotonChat\Code\ChatClient.cs", line 232, inside ChatClient.Connect
, we clear private channels.
this.PrivateChannels.Clear();
You can comment out this line and see if it helps.
Back to top