I use strophe.js library to send and receive XMPP messages in browser. It works fine, but only for users I already have in my contact list – roster.
I need to add someone (whose address I know) to my roster. How can I achieve this using strophe.js? This is important for me since gmail refuses sending messages to people I don’t have in my roster. I’d like to get subscription: both, to be able to receive and send messages.
Send
<presence to="friend@example.com" type="subscribe"/>:When your friend accepts, they should send a subscribe to you also, which you can handle by setting a Strophe handler for incoming presence with type “subscribe”: