Wrap-Up

Hello all,

This was indeed an exciting summer. During this summer, I initially implemented the elements along with their parsers and serializers, required to implement the MIX features. Then I implemented a MIX Registry to keep track of channels joined by a client, and sync the same information with their rosters. This Registry is responsible for returning an object of the joined channel, which can be used for various features like setting nick for the channel, sending messages, etc. Finally. I implemented basic functionalities for MIX in Swiften, along with a MIX Example client and MIX Mock Server to respond to clients. Let me explain the features I have added as part of GSoC'17 along with examples:

1.) Client querying MIX service for hosted channels: This allows my client to query server for hosted channels.

2.) Client querying for publish-subscribe nodes supported by MIX channel: This allows my client to query server for supported standard nodes for a MIX channel.

3. Client joining a channel hosted on MIX domain: Client then published its already joined channels and sends a request to channel service to join.
./Swiften/Examples/MIXListAndJoin/MIXListAndJoin another@example.com/some mixtest2 example.com
Connecting...Connected
Request list of channels.
List of rooms at example.com
 1. coven - coven@example.com

Request supported nodes for MIX channel: coven@example.com
Nodes supported by channel coven@example.com
 1. urn:xmpp:mix:nodes:participants
 2. urn:xmpp:mix:nodes:messages
 3. urn:xmpp:mix:nodes:presence
 4. urn:xmpp:mix:nodes:jidmap

Already Joined channels: 
No channels already joined.

Successfully joined channel coven@example.com
[warning] Swiften/MIX/MIXRegistry.cpp:40 joinChannel: Channel already joined: coven@example.com
In the example above, user with JID another@example.com/some initially connects to server and request list of channels, followed by supported nodes for MIX channel.
  • urn:xmpp:mix:nodes:participants: holds information about all participants of the channel along with their nick.
  • urn:xmpp:mix:nodes:messages: holds all messages sent to the channel.
  • urn:xmpp:mix:nodes:presence: holds presence status for all clients of the channel.
  • urn:xmpp:mix:nodes:jidmap: holds mapping information from client's real JID to proxy JID.
The warning in above example indicates a use case where user tries to join an already joined channel.

4.) Join Sync: This is an interesting and much required feature, which allows different clients of the same user to sync already joined channels and other information.
./Swiften/Examples/MIXListAndJoin/MIXListAndJoin another@example.com/someelse mixtest2 example.com
Connecting...Connected
Request list of channels.
List of rooms at example.com
 1. coven - coven@example.com

Request supported nodes for MIX channel: coven@example.com
Nodes supported by channel coven@example.com
 1. urn:xmpp:mix:nodes:participants
 2. urn:xmpp:mix:nodes:messages
 3. urn:xmpp:mix:nodes:presence
 4. urn:xmpp:mix:nodes:jidmap

Already Joined channels: 
 1. coven - coven@example.com

[warning] Swiften/MIX/MIXRegistry.cpp:40 joinChannel: Channel already joined: coven@example.com
In the example above, same user another@example.com tries to connect to server with JID another@example.com/someelse initially connects to server and client successfully indicates already joined channels and yet another warning when user tries to join an already joined channel.

5.) Retrieve Participants of Joined channel: This allows a client to retrieve the list of participants of the joined channel. This however, only returns proxy JIDs of the participants along with their nicks, if set by user.

6.) Real JID lookup of participants: This allows a client to lookup participants proxy JID in the channel and retrieve its real JID. Right now, the present client only offers join as a simple join with subscriptions, however for join with preferences, if user have jid-hidden preference for its JID Visibility, then this will still return participants proxy JID.

7.) Sending/Receiving Messages: The client can now send messages to the channel, which will be forwarded to all online clients and a replicated message will be sent to sender with same submission ID as the ID of message sent.

Client I
./Swiften/Examples/MIXListAndJoin/MIXListAndJoin another@example.com/some mixtest2 example.com
Connecting...Connected
Request list of channels.
List of rooms at example.com
 1. coven - coven@example.com

Request supported nodes for MIX channel: coven@example.com
Nodes supported by channel coven@example.com
 1. urn:xmpp:mix:nodes:participants
 2. urn:xmpp:mix:nodes:messages
 3. urn:xmpp:mix:nodes:presence
 4. urn:xmpp:mix:nodes:jidmap

Already Joined channels: 
No channels already joined.

Successfully joined channel coven@example.com
[warning] Swiften/MIX/MIXRegistry.cpp:40 joinChannel: Channel already joined: coven@example.com

Participants of channel coven@example.com
 1. 99ba30b1-0d0a-4739-95ad-fc1eb3c12a49#coven@example.com

Lookup of participant in channel coven@example.com
 1. 99ba30b1-0d0a-4739-95ad-fc1eb3c12a49#coven@example.com - another@example.com

[ coven@example.com ] : Hello, I am here! some
Client II
./Swiften/Examples/MIXListAndJoin/MIXListAndJoin some@example.com/some mixtest example.com
Connecting...Connected
Request list of channels.
List of rooms at example.com
 1. coven - coven@example.com

Request supported nodes for MIX channel: coven@example.com
Nodes supported by channel coven@example.com
 1. urn:xmpp:mix:nodes:participants
 2. urn:xmpp:mix:nodes:messages
 3. urn:xmpp:mix:nodes:presence
 4. urn:xmpp:mix:nodes:jidmap

Already Joined channels: 
No channels already joined.

Successfully joined channel coven@example.com
[warning] Swiften/MIX/MIXRegistry.cpp:40 joinChannel: Channel already joined: coven@example.com

Participants of channel coven@example.com
 1. c0a202ff-adce-4a07-8d90-577b4e986321#coven@example.com
 2. 99ba30b1-0d0a-4739-95ad-fc1eb3c12a49#coven@example.com

Lookup of participant in channel coven@example.com
 1. 99ba30b1-0d0a-4739-95ad-fc1eb3c12a49#coven@example.com - another@example.com
 2. c0a202ff-adce-4a07-8d90-577b4e986321#coven@example.com - some@example.com
Above two examples shows client I joining, retrieving participant list (only himself for now), and lookup of real JIDs of participants. Then client II connects, repeats the same procedure as client I, and sends a message Hello, I am here! some to channel, which is forwarded to client I. Client II simply ignores the replicated message, however it can still be useful to correlate the message with the submitted message.

8.) Setting Nick for joined channel: The client can set its nick for joined channels. If there is a nick conflict, an error payload will be returned with ErrorPayload:Condition:Conflict.

9.) Presence updates: With this client can now receive presence of all participants of the channel, as well as updated its  own presence. Client can go offline, and indicate its unavailability to other clients and similarly come online again. When a client joins a new channel or comes online after being online, channel presence of all participants is pushed to the client. 

Client I
./Swiften/Examples/MIXListAndJoin/MIXListAndJoin some@example.com/someelse mixtest example.com
Connecting...Connected
Request list of channels.
List of rooms at example.com
 1. coven - coven@example.com

Request supported nodes for MIX channel: coven@example.com
Nodes supported by channel coven@example.com
 1. urn:xmpp:mix:nodes:participants
 2. urn:xmpp:mix:nodes:messages
 3. urn:xmpp:mix:nodes:presence
 4. urn:xmpp:mix:nodes:jidmap

Already Joined channels: 
No channels already joined.


Successfully joined channel coven@example.com
[warning] Swiften/MIX/MIXRegistry.cpp:38 joinChannel: Channel already joined: coven@example.com

Nick Assigned: some

Participants of channel coven@example.com
 1. 0b8f6eb8-f42e-4ad8-b059-7052224790dc#coven@example.com Nick: [some]

Lookup of participant in channel coven@example.com
 1. 0b8f6eb8-f42e-4ad8-b059-7052224790dc#coven@example.com - some@example.com

Client is now online 

[ coven@example.com ] : fff754f9-a050-48ad-87d8-3178fab98774#coven@example.com is available 
[ coven@example.com ] : Hello, I am here! yetanother
[ coven@example.com ] : 8cb2cef7-37d6-47f4-9af4-42796043bb33#coven@example.com is now unavailable 
[ coven@example.com ] : 8cb2cef7-37d6-47f4-9af4-42796043bb33#coven@example.com is available 
[ coven@example.com ] : Hello, I am here! another

Client II
./Swiften/Examples/MIXListAndJoin/MIXListAndJoin yetanother@example.com/someelse mixtest example.com
Connecting...Connected
Request list of channels.
List of rooms at example.com
 1. coven - coven@example.com

Request supported nodes for MIX channel: coven@example.com
Nodes supported by channel coven@example.com
 1. urn:xmpp:mix:nodes:participants
 2. urn:xmpp:mix:nodes:messages
 3. urn:xmpp:mix:nodes:presence
 4. urn:xmpp:mix:nodes:jidmap

Already Joined channels: 
No channels already joined.


Successfully joined channel coven@example.com
[warning] Swiften/MIX/MIXRegistry.cpp:38 joinChannel: Channel already joined: coven@example.com

[ coven@example.com ] : 0b8f6eb8-f42e-4ad8-b059-7052224790dc#coven@example.com is available 
Nick Assigned: yetanother

Participants of channel coven@example.com
 1. fff754f9-a050-48ad-87d8-3178fab98774#coven@example.com Nick: [yetanother]
 2. 0b8f6eb8-f42e-4ad8-b059-7052224790dc#coven@example.com Nick: [some]

Lookup of participant in channel coven@example.com
 1. 0b8f6eb8-f42e-4ad8-b059-7052224790dc#coven@example.com - some@example.com
 2. fff754f9-a050-48ad-87d8-3178fab98774#coven@example.com - yetanother@example.com

Client is now online 

[ coven@example.com ] : 8cb2cef7-37d6-47f4-9af4-42796043bb33#coven@example.com is now unavailable 
[ coven@example.com ] : 8cb2cef7-37d6-47f4-9af4-42796043bb33#coven@example.com is available 
[ coven@example.com ] : Hello, I am here! another
Client III
./Swiften/Examples/MIXListAndJoin/MIXListAndJoin another@example.com/someelse mixtest example.com
Connecting...Connected
Request list of channels.
List of rooms at example.com
 1. coven - coven@example.com

Request supported nodes for MIX channel: coven@example.com
Nodes supported by channel coven@example.com
 1. urn:xmpp:mix:nodes:participants
 2. urn:xmpp:mix:nodes:messages
 3. urn:xmpp:mix:nodes:presence
 4. urn:xmpp:mix:nodes:jidmap

Already Joined channels: 
No channels already joined.


Successfully joined channel coven@example.com
[warning] Swiften/MIX/MIXRegistry.cpp:38 joinChannel: Channel already joined: coven@example.com

[ coven@example.com ] : fff754f9-a050-48ad-87d8-3178fab98774#coven@example.com is available 
[ coven@example.com ] : 0b8f6eb8-f42e-4ad8-b059-7052224790dc#coven@example.com is available 
Nick Assigned: another

Participants of channel coven@example.com
 1. 8cb2cef7-37d6-47f4-9af4-42796043bb33#coven@example.com Nick: [another]
 2. fff754f9-a050-48ad-87d8-3178fab98774#coven@example.com Nick: [yetanother]
 3. 0b8f6eb8-f42e-4ad8-b059-7052224790dc#coven@example.com Nick: [some]

Lookup of participant in channel coven@example.com
 1. 0b8f6eb8-f42e-4ad8-b059-7052224790dc#coven@example.com - some@example.com
 2. fff754f9-a050-48ad-87d8-3178fab98774#coven@example.com - yetanother@example.com
 3. 8cb2cef7-37d6-47f4-9af4-42796043bb33#coven@example.com - another@example.com

Client is going offline 

Client is now online 

[ coven@example.com ] : fff754f9-a050-48ad-87d8-3178fab98774#coven@example.com is available 
[ coven@example.com ] : 0b8f6eb8-f42e-4ad8-b059-7052224790dc#coven@example.com is available
In above examples, client I joins first, sets its nick and indicates itself to be online. Then it just wait for message/presence updates from other clients. Then client II joins, receive presence status of client I on successful join, and sends a message which is received by client I (only other online client). Then client III joins, sets its nick, receive presence status of client I and client II on successful join, and then goes offline. As it goes offline, client I and II now receive presence updates indicating that client III is now unavailable. Then client III comes online again after 3 seconds and receive full presence updates from channel. Finally, it sends a message to channel, which will be received by client I and II. When clients go offline, neither they will receive any message nor any presence updates.

Challenges/RoadBlocks:

I would also like to include what challenges and progress struggles I faced while working on this project:

  • Firstly, the major challenge I faced was unavailability of a working MIX server. If a working MIX server was available, checking my client implementation could have been a lot easier. This forced me to write a mock server using limber framework, which could mock the responses of an actual server. This wasn't originally planned as per the proposal, but was an immediate requirement.
  • Secondly, having worked on implementing MIX features till last week of July, we had a major design change for our MIX implementation in first week of August. Initially the MIXImpl was handling all channel requests, however as per advice from mentors, I created a MIX Registry class which took care of joining / leaving channels and provide instances of MIXImpl for the joined channel. So in essence, the MIXImpl class will now only handle methods for one joined channel. This is indeed a very efficient design, and also allows syncing of roster across different clients of same  user.
I would like to thank my mentors Edwin, Tobias and Kevin for successfully guiding me through this project. I would like to continue working on this project after GSoC as a lot of new features could be added and also integration of MIX in Swift.

That's all for now :)

Comments

Popular posts from this blog

Week 9 & 10

Week 5 & 6