添加好友时, set roster是可选的。只发送 type=subscribe的presence即可

 
添加好友时, set roster是可选的。只发送 type=subscribe的presence即可。 set roster 也只是为了添加昵称和分组用的
有同事问起,结果忘记了,就又翻阅了一下文档,如下描述

Implementation Note: Many XMPP clients prompt the user for information about the potential contact (e.g., "handle" and desired roster group) when generating an outbound presence subscription request and therefore send a roster set before sending the outbound presence subscription request. This behavior is OPTIONAL, because a client MAY instead wait until receiving the initial roster push from the server before uploading user-provided information about the contact. A server MUST process a roster set and outbound presence subscription request in either order (i.e., in whatever order generated by the client).

你可能感兴趣的:(type)