Rather Than Use Open Source Co-browsing We Built Our Own
Building Upscope's co-browsing solution turned out to be significantly more complicated than your typical CRUD app. Upscope is built from the ground up as there were a limited set of open source co-browsing solutions. Below are some notes from our CTO on the main challenges you might find and how to overcome them.
Related: The Ultimate Guide To Co-browsing
Related: Get Started with Co-browsing using the Upscope Developer Hub
Compile html into JSON
To pass it, we compiled the whole HTML into a JSON object including tag name, attributes and content and parsed it on the other side and built it element by element in the iframe and changed all links to the proxy server.
Proxy CSS files
We need to proxy CSS because:
- Their server might block access to our server on the basis that it's not the same domain.
If the CSS is not reachable by our server, we'd make an Ajax request, encode it and send it with the rest of the page from the user's browser.
Identify changes to the page
We use mutation observer which is built into the browser. There's Shim for older browsers (IE 10 and 9) and that gives a notification if there are any changes on the page so you don't have to look at the document every few seconds.
Work with Canvases
To make it work with canvases, there's a call you can make to convert the canvas into a png picture. You would then compare the pictures at two points. If it's the same, nothing happens, otherwise we send over the new picture.
Manage events over server clusters
Because we have a cluster of different servers, we could not control whether some events reached the agents before others, especially events that have more data that take longer to travel through the network. Therefore we started numbering the events so that they are executed in the same order they happen on the users browser.
Maintain connections while scaling servers
Because we have a scaling system for servers, sometimes a server would be removed from the cluster, several thousand clients would seek to connect to another server quickly. But due to rate limiting, ongoing sessions would not connect right away so we had to have a preferential route for ongoing sessions. A way to bypass our own rate limit.
Get a copy of Upscope co-browsing on your server or use the API
If you're looking for more control over a co-browsing solution and don't want spend time building your own or use open source solutions, you can get Upscope's on-premise co-browsing solution and integrate it directly into your systems and have all data only pass through your own systems.
Chat with our lead dev
If you'd like to talk to the lead developer for the API, go to this page and ping us on our chat box or email him on email@example.com.
Pardeep overlooks growth at Upscope and loves writing about SaaS companies, customer success and customer experience.