In this post, we’ll explain how to manage collaboration instances (we call the workspaces) on the XTWIP infrastructure. The workspace is an XML description of the data in your application, which several instances and several users can access, modify and interact with at the same time.
Think of the workspace as some sort of real time interactive, collaborative document.
workspace = real time XML document
While running a collaborative instance of your application, all changes are tracked, sent to all online participants and saved on the XTWIP. However, in this post we’re going to show you how to create, delete and access a workspace.
As a third party application developer, all you need to do is post a request to our front end server, authenticating yourself by sending the devKey provided to you. The server will respond with the workspaceID assigned to that workspace. You will need to store this ID, since you will later need it to refer the workspace. For more information on how to post a create workspace request, go through the XTWIP JSON-RPC API Reference [pdf].
Here’s what happens when you make the request
As a general fact, the business logic inside the XTWIP infrastructure is transparent to you. In order to manage collaboration instances, you only need to post the JSON-RPC requests and interpret the results.
After you’ve created the workspace, your main concern will be how to access it: how to make your application aware of the collaboration instance and make sure all changes are delivered on that instance.
The XTWIP SDK for Flash/Flex automatically looks for the authentication information it needs to connect to the workspace in the flashvars of the embed code of your application. In order to get that authentication information however, you need to follow the steps described below:
This combination of devKey and temporary credentials bares several guarantees of security and flexibility:
The workflow for deleting a workspace is almost the same as for creating one, the only exception being you need to provide the ID of the workspace you wish to delete.
We hope this post provided an overview on how you, as a developer, can manage the collaboration instances hosted on the XTWIP infrastructure. For a more detailed understanding of creating, deleting, accessing and retrieving workspaces, go through the XTWIP JSON-RPC API Reference [pdf].
This implementation of real time collaboration seems to offer the best balance between performance, usability and developer needs. This is why we chose it for the current XTWIP implementation of collaboration.
The object based approach follows these 4 simple rules:
<!– The document is an important tag, so it gets a unique ID –>
<document id=”7″>
<!– The same goes for the button –>
<button id=”9″>
<!– The attributes of the button however, are not that important from a collaborative stand-point –>
<label text=”Collaborative Button” color=”6600FF”>
<background src=”xtwip_logo.jpg>
<background color=”222222″>
<link url=”http://www.xtwip.com”>
</button>
[...]
</document>
This (apparently) simple protocol provides application developers with a simple gateway to collaboration. No longer do they have to write server-side code or write their own custom code for diffing and merging differences. The XTWIP SDK together with the XTWIP Collaboration Service provide that for just a few lines of code. All developers need to do is read the tutorial, drop a few lines of code into their application and they can redeploy their application as a collaboration experience.
Let’s look at the advantages:
There are only two disadvantages:
Number one. If two users happen to modify the exact same atomic object at the same time (within 300 ms of each other, on average), the XTWIP SDK will automatically merge the two changes. When merging fails, the last change performed will implicitly have priority. Merging means a further analysis of what has changed (attributes, child tags) and putting it all together. Merging usually fails when the two users change exactly the same attributes and no automatic conclusion can be drawn as to who’s right.
In our experience, however, this type of fine-grained micro-conflict between versions is very rare. When it does happen, the users notice it right away. They tend to immediately react and choose a final state for the change they wanted.
Number two. Whole pieces of the data model are serialized and send across the network, so if your application deals a lot with raster image editing, object-based collaboration is not the best idea (at least, not by itself).
If you want to try this type of real time collaboration with your own application, create a Developer Account on XTWIP and there you’ll find everything you need:
For this example, we’ll consider a simple application in you can draw boxes, and you have only 4 options:
It means that instances of the application transmit across the network only the actions taken in order to get from the old state to the new state. This is extremely useful if you have data models that take up a lot of space (like 3D polygon models), but changes made to them can be described using very little space.
So let’s say you have application A and application B, working on the same instance containing square1 and square2. Let’s say square1 is already rotated by 30 degrees, and instance A rotates it with another 15 degrees (to a total of 45 degrees). Instead of sending out rotateBox(square1, 45), it sends out rotateBox(square1,15). The great advantage of this approach if two rotations occur in (near) real time, they can get composed over the network. So if, at the same time, application B, applies and additional rotation of 10 degrees, the end result (in both instance A and B).
The order on the generated events will be the order they reach the XTWIP server. It this case, it may seem that the order of the events is irrelevant, but most actions (operations) are not commutative – that is changing the order of two actions changes the end result they yield.
The advantages of this approach:
The disadvantages are however more subtle and only through implementing experience did we learn about them:
These significant disadvantages of the event-driven model lead us to the decision that we needed an alternative way of offering real time collaboration, with less debugging, less risks and less work. This is how we came up with the object-driven collaboration model …
* Keep following the Types of Collaboration series to get a true insight on how XTWIP provides real time collaboration for your Web & Rich Internet Applications.
When we started XTWIP, we had a simple vision: allowing people to change the same content at the same time. We strongly believe that this can help getting more work done together, without losing time with emails, phone calls and (worst of all) meetings.
However, we soon realized that from a technical stand-point there are three fundamental ways of implementing real time collaboration. To the end-user this probably has no impact whatsoever. But for the developer who makes his/her application collaborative, it is of great importance to choose the best mix of these models:
In the following posts, we’ll explain the differences between these types of collaboration and how you should pick the one the suits best your use case/business case.
We’re inviting you to a new demo of XTWIP collaborative solution . Click on the link below to see the real time capabilities of XTWIP in a simple sample application developed by one of our collaborators.
This application is cooler if several people use it at the same time. So don’t forget to invite your friends.
Failing that, open the link in two separate browser windows and see how the changes from one reflect on the other.
Don’t forget to give us feedback - just post a comment below or Twitter us.
Recently, we have been asked whether TWIP is a direct competitor of Wave, the latest and hottest technology since Maps.
How is TWIP different ? Do we believe in the success of Wave? Do we have the same market?
“Are you out of your mind competing with Google?” some of you could ask. Yes, we are. But we don’t think of it as competition.
First of all, we thank Google for introducing and explaining the concept of real time collaboration to the online community and to the web industry. Wave is a powerful conversational tool, extremely extensible and easy to integrate with other web-applications. We hope that, along with other tools on the market, developers will become more and more attracted to building collaborative software.
So what are the differences between Wave and TWIP?
From a technical standpoint, the two solutions converge to the same idea : servers that manage the communication and synchronize the content between users. TWIP uses XMPP for message management just like Wave. To some extent, both use Operational Transforms to merge changes into the data model.
In terms of target, we are not addressing the same users.
Wave is the newest conversational tool. It has a lot of cool features (have you seen the spell checker?…wow), all perfect for it’s raison d’etre: a conversational tool. Even if extended, it is still a tool for real-time ubercool chat. The External API developed for integrating Wave into other websites is purposed to offer conversations as widgets.
As far as we are concerned…
We are building a platform to host & support applications, each of which individually has it’s own scope. They can exists just fine without TWIP. We are only offering an easy solution for those who want this cool feature named real-time collaboration. They may use it however they want. Even build online games if that’s what they like.
While Wave is more about facilitating the conversation, TWIP is about merging conversation & workflow. Switching between actual work (coding, designing) and feedback (revisions, brainstorming, user reviews) can be time-consuming and exhausting. That’s why we want to rid people of multi-tasking, allowing them to communicate as well as to create at the same time.
Our platform is ready, just a few more finishing touches and it will be online. We’re eager to receive your feedback.
Here are our plans for the near future:
Please let us know if you’re interested in any of these. Your feedback is our driving lesson.
See ya
[ A bit of TWIP's technical side, behind the scene ]
TWIP is going to be more than just a bunch of collaborative apps. It will also be the protocol behind those apps, that we plan to make available to other developers as well. So we started thinking about how we could make this protocol compatible with as many technologies as possible.
Java is what we’re working on right now. Dot Net is not too far. But then we thought: let’s make the TWIP protocol available for JavaScript and GWT. The GWT/JS trend is taking over the client-sided Internet one day at the time, so why not make a TWIP API for it? And it can be done…
… but there is a catch.
JavaScript can’t work with sockets. It can only work with (XML) requests. JS can’t keep a connection open and wait for the server to send incoming messages from other users. Rather, the client must periodically send requests for updates and wait for the server to provide them. Although this isn’t a major drawback, it is a inconvenience, since any protocol working exclusively with request isn’t exactly real-time. And this is one of the reasons Google Docs and other collaborative platforms out there have trouble with guaranteeing true synchronization.
So here’s the deal… First, the TWIP API will be Java – that’s for sure. Next we’ll consider writing a Dot Net API. And last, but must definitely not least – GWT and JavaScript – with the XMLRequest-oriented protocol. What we aim for is making these APIs interoperable with the TWIP server, so third-party developers can easily develop their collaborative apps in whatever fashion they see fit. We’ll leave it up to them to decide if on the client-side they go for the robust connection-oriented approach (in Java, JavaFX or Dot Net) or for the light-weight, flexible XML request based approach (in JavaScript and GWT).
So what do you think ?
We need your opinion for the color of our logo.
Should it be green ?
![9th Prime [Green] 9th Prime [Green]](http://9thprime.files.wordpress.com/2009/01/9thprime.png)
9th Prime [Green
![9th Prime [Blue] 9th Prime [Blue]](http://9thprime.files.wordpress.com/2009/01/9th_prime_blue.png)
9th Prime [Blue
The most essential part of TWIP is the real time collaboration. Everybody should see what everybody else is doing in a a split second. In order for that ho happen, you need a server. A central authority. A point with which all users synchronise.
Most of all, you need that to preserve coherence. Another big word, right ? Coherence means that all users do the operations in exactly the same order. Let’s say user A draws a red line and sends a message to user B (so B can have it drawn as well). User B, less than a second after, draws a green line on top of the red line. Now, without preserving coherence, user A will see the green line underneath the red line and user B will see the green line above the red line. This would happen because each user would get the message from the other user with a certain delay. And we wouldn’t fix that, the whole collaboration thing would suck, as we’d have no way of knowing that the same data is available on all computers. Fortunately, we have a way to fix that and this is done by a server, a central authority. Think of it as a commander who keeps the privates in attack formation. The thing for you to remember right know is coherence, as being essential.
Next there is the question of extensibility, scalability. Let’s say we fix this whole coherent method of synchronisation. A text editor. Or a picture editor. Or for a piece of software for editing programming code or 3D models. We’ll put a lot of work into the sync engine and into the application itself, but what about all the other apps ? So we thought it’d be waaaay cooler to have this synchronisation engine avaialable onto which we could build. Or anyone else for that matter. There would be no point in our trying to develop all these collaborative apps, when there are a of really intricate, exciting pieces of software available. All they need is the collaboration scheme.
So this is how we thought about the Framework. Basically, this would be the synchronisation engine onto which to build. Think of it like a programming interface or an API. Regardless (almost regardless) of application a few simple rules should be respected and the collaboration would come right in !
Then, we thought we’d do everything in Java, so it would be portable on any OS, both on the client side and on the server side. This even opens the perspective of making a mobile version of TWIP, but let’s no get ahead of ourselves.
Java opens more doors for our project. Like the transparent application distribution. This means that all the apps are stored on the server-side, and when a users wants a new app, it automatically downloads and plugs in together with all the TWIP resources on the client system.
As far as the server is concerned, it has four major roles:
Look at the diagram below to get a better picture of the whole relationship between the clients and the server:
On the server-side, synchronisation also means the server must keep an updated version of all the data. So the server must constantly read the messages received from clients and change the stored data accordingly.
Right now, I and my team-mate, Cristi, are working on the Framework and on the synchronsation schemes.
What would be really useful to us would be having your feedback. Tell us how collaboration would work for you. Tell us what you need and what you’d think is cool as far as team work is concerned.
Give us the top three applications you would use in a collaborative fashion, with your friends. Ask your friends. Leave a comment or two
The greatest thing about XTWIP is that it can easily be attached as a layer over your BI or MiddleWare applications [...] I believe this is the ultimate step a company should take in its efforts to increase productivity.
Val Vladescu , BiVal NE , BPM Solutions Integrator