Wouldn’t it be great if you could start an audio and video chat with any co-worker from inside Salesforce?

Well, that’s now possible through a cool integration between GoInstant (a company Salesforce acquired in 2012), WebRTC and Visualforce. Before we get into how it works and share some code with you, let’s dig into the individual pieces of the puzzle.

What is GoInstant?

GoInstant is a backend-as-a-service (BaaS) for building real-time applications. It allows you to store and synchronize data very easily. Think of applications where you need multiple users communicating, or you need data being displayed to people as fast as possible. There are lots of interesting use cases for GoInstant — and you can sign-up for free to give it a try at https://goinstant.com.

What is WebRTC?

WebRTC (or Web Real-Time Communication) is a new API being made available natively in your web browser to enable video/voice calling and P2P file transfer using JavaScript and HTML5. WebRTC handles the complicated networking and audio/video components necessary for this type of real-time communication. Best of all, the WebRTC framework is available in supported browsers without the need for any plugins. To learn more, check out webrtc.org.


How do GoInstant and WebRTC work together?

GoInstant recently launched an integration between its core API and WebRTC to provide you with the easiest way to setup WebRTC in any application.

GoInstant provides two key pieces that WebRTC is missing — specifically, presence and signalling. Both of these are left to the application developer when using WebRTC on its own, which means you need to setup and configure a backend and handle the complexities of getting WebRTC working. GoInstant comes with ready made solutions to the lack of presence and signalling in WebRTC. Presence is built into our Rooms API, while Keys and Channels are ideal for signaling. Keys are great for keeping track of which users have their camera turned on, and Channels are perfect for the type of one-off messages used in the WebRTC session negotiation.

So GoInstant built GoRTC, a lightweight (218 SLOC) library, which makes it incredibly easy to integrate WebRTC into your application. You don’t need a server or backend whatsoever. GoRTC is also open source!

GoInstant extended their base library into what they call a widget — specifically the WebRTC widget. It has additional functionality built in that you can use out of the box, including standard audio/video controls for pausing, muting and expanding a user’s video stream.

You can see all of this come together in a slick demo of GoInstant’s WebRTC integration, where you can video and audio chat with friends: http://webrtc.goinstant.com.

Here’s how GoInstant’s WebRTC widget works:

It’s really as easy as that. You could include similar code into your own application and have audio/video chat ready to go!

So how does this all fit with Visualforce?

We’re big fans of WebRTC (which is gaining in popularity within the enterprise space), and we were really impressed with GoInstant’s integration. But we wanted to add audio and video chat directly into Salesforce. And that’s exactly what we did.

We took the GoInstant WebRTC code (which is all open source) and integrated it into a Visualforce page. We then added a link to a person’s individual profile page so that you could audio/video chat with them when they’re online.

Here is what it looks like with a single user in a video room embedded in the Chatter Feed!

Here is what it might look like as a full Visualforce page!


It’s a simple implementation inside of Visualforce, but you could extend it quite a bit. You could add live audio/video chat to anything inside Salesforce — imagine being able to collaborate and chat around a sales lead, or when reviewing a quarterly report!

Let’s take a look at some of the code and what’s going on:

Most of the code above was cut and pasted directly out of the GoInstant sample from the documentation.

It’s really as simple as that! With just a bit of code, we can combine GoInstant, WebRTC and Visualforce to provide audio/video conferencing inside Salesforce. There are tons of possibilities, and lots of ways you could extend this code into your own Salesforce implementation or your own applications.

Here are some links to get started:

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS