Is there a way to chat a stranger without adding them to the friend list?
Hello @aliakbarm534,
The users do not need to be friends to be able to chat, they only need to accept the incoming chat request by joining the chat and targeting the requester.
The target user must accept the incoming message? What if I want to send it directly?
I tried a simple code like this chatChannel = await _connection.Socket.JoinChatAsync(userId, ChannelType.DirectMessage, persistence: true, hidden: true);
but I got error WebSocketException: Invalid channel target
. I literally copied the user id from the panel and the target was online. Does it really don’t have to be friends?
They do not need to be friends. The clients need to be listening for in-app notifications.
Then user1
does joinChatAsync
with user2
as the target, and user2
receives a notifications signaling that user1
is trying to chat with him, at which point he can also call joinChatAsync
with target user1
.
Please check the server logs for more information on the error. Are you running the latest version of Nakama?
Hi, it’s working now. It turns out I made a silly mistake by referencing a wrong value. Thanks for the support.