Third party client collaboration

Connecting a Third Party Client

The HoloBuild Library offers a collaboration component that allows real-time data transmission between multiple Hololenses and third party devices. Collaboration happens via WebSockets. More specifically the library . provides client API's in multiple languages which can be found here.

A little bit of background knowledge before we continue: The BuildWagon Collaboration Server is a server that hosts the collaboration "Rooms". Rooms can only be created through a BuildWagon client. All the devices that wish to collaborate together will then have to join the same room.

Data communication then happens in an event-based manner, where each device sends messages to the entire room to "listen" to. To start emiting and receiving data, first you need to connect to the BuildWagon Collab server. Then, you can connect to your specific room. For security purposes, your client needs to be authenticated before emiting messages to the room. To get authenticated you need a token that will be provided to you by request. After getting authenticated, an id needs to be assigned to the connection. This can be any randomly generated GUID. Now that your client is connected you can emit and listen to messages in the room.

Pseudo-Code for connecting to a room.

Socket connect to ("");
On("connect", () =>
	Socket connect to ("/roomName");
	Emit("authenticate", {token: "eyJ0eXAiOiJ…"});
	On("authenticated", (data) =>
		Emit("assignId", "GUID-132…");
		Emit("room", {name: "holodeck1", id: "GUID-132…", create: false,
		Emit("message", {data : data , data : data ...});
		//...Emit/On other message here...

Using Javascript

console.log('setting up connection...');
var socket = io('')
socket.on('connect', function () 
  		console.log('connected to' )
	    var holodeck = io("");
	    holodeck.on('connect' , function()
	    		console.log('connected to room1');
		    	holodeck.emit("authenticate", {token:"lpg6oWF0IjoxNTQwMzI2OTM3LCJleHAiO1YiI6Im1obGFyb3NlQG1hcmludmVudC5jb20iLCJhY2NvdW50IjoiaG9sb2RlY2sifQ.fZqN9WXmWYGnPEzNdytr2RABqVkMyKABVkTdfs7IFi0"});
		     	holodeck.on("authenticated" , (data) =>
	     			console.log('authentication successfull');
	     			holodeck.emit('assignId' , 'GUID-a082e898-e0cc-424d-8ab3-4c9f66109318');
	     			holodeck.emit('room' , {name: 'holodeck1' , id: 'GUID-a082e898-e0cc-424d-8ab3-4c9f66109318' , create: false, password: 'xyz'});


Using C#

// A socket manager definition, connecting to the host uri
 var manager = new Manager(new Uri(""));
 var socket = manager.Socket("/");

 // Authentication JSON object definition that takes a signed token
 var jAuth = new JObject();

 jAuth["token"] =

 // Room JSON object definition
 var jRoom = new JObject();
 jRoom["name"] = "holodeck1";
 string connId = Guid.NewGuid().ToString("N");
 jRoom["id"] = connId;
 jRoom["create"] = false;
 jRoom["password"] = "xyz";

 // Sample message JSON object definition: turn light on
 var jMessage = new JObject();
 jMessage["Action"] = "light";
 var jMessageParams = new JObject();
 jMessageParams["status"] = 1;
 jMessage["params"] = new JObject(jMessageParams);
 // listen on socket connect (called when socket connects to host)
 socket.On(Socket.EVENT_CONNECT, () =>
 // re-define the socket connection, this time connecting to the namespace
 var HoloDeck = manager.Socket("/holodeck-poc");
 // listen on socket connect (called when socket connects to the namespace)
 HoloDeck.On(Socket.EVENT_CONNECT, () =>
 // emit an authenticate event that takes the JSON jAuth variable defined above
 HoloDeck.Emit("authenticate", jAuth);
 // listen on authenticated (called if the request has been authenticated successfully)
 HoloDeck.On("authenticated", (data) =>
 // emit assingId event to assign a unique id for this connection (a variable defined above)
 HoloDeck.Emit("assignId", connId);
 // emit room event to join the room defined by the JSON object jRoom defined above
 HoloDeck.Emit("room", jRoom);
 // emit message event along with a JSON object jMessage defined above (this will send a light action with status 1)
// message events will be sent to the joined room
 HoloDeck.Emit("message", jMessage);
 // listen on message received do something (this is a sample listener on the message events)
 HoloDeck.On("message", (data) =>
 // listener for messages
 // open the HoloDeck socket connection defined above