I am trying to develop a chat app using Ejabberd 16.09, the only way i find to unsubscribe a user is
<iq from='hag66@shakespeare.example'
to='coven@muc.shakespeare.example'
type='set'
id='E6E10350-76CF-40C6-B91B-1EA08C332FC7'>
There is any way to automatically unsubscribe the user when he leave the room?
Or anyway to someone else to remove his subscription?
There is any way to automatically unsubscribe the user when he leave the room?
No.It can not be done. The purpose of introducing MUC/Sub is that even if user is not part of room, one can get notification/messages via subscription which won't happen in case of normal muc behavior(xep-0045).
If you want to unsubscribe when user leaves room, then i don't see any reason why you are using MUC/SUB.Normal MUC will properly suit for your behavior.