Anonymous Users

Last Edit: Nov 02 2020

If a user is not logged in, you can call the setAnonymousUser method. While you’re anonymous, you can’t do much, but for the livestream channel type, you’re still allowed to read the chat conversation.


const connectResponse = await client.setAnonymousUser();

console.log(connectResponse.me);
                    

client.setAnonymousUser(null);
                    

Client.shared.setAnonymousUser()
                    

client.setAnonymousUser()
                    

When you connect to chat using anonymously you receive a special user back with the following data:


{
	"id": "!anon",
	"role": "anonymous",
	"roles": [],
	"created_at": "0001-01-01T00:00:00Z",
	"updated_at": "0001-01-01T00:00:00Z",
	"last_active": "2020-11-02T18:36:01.125136Z",
	"banned": false,
	"online": true,
	"invisible": false,
	"devices": [],
	"mutes": [],
	"channel_mutes": [],
	"unread_count": 0,
	"total_unread_count": 0,
	"unread_channels": 0,
	"language": ""
}
                    
Anonymous users are not counted toward your MAU number and only have an impact on the number of concurrent connected clients.