Private Rooms in BlueChat

Creating Private Rooms:

For every occasion of two users needing to chat(video/ text/ data), we create a new room to facilitate and secure their communications.
Creating a room in BlueCam is done on your server with a single PHP command:
PHP
$BlueCam = new BlueCamAPI(array());
$roomId = $BlueCam->CreateRoom(array(
	"owner"=>"ownerUserId",
	"visitor"=>"visitorUserId"
));

PrivateRoom Properties

BlueCam stores some persistent data about the room in the database for systematic reference and to facilitate and streamline the WebRTC handshake

Private Rooms in the Client Browser

Once each user logs in, they need to navigate to video chat with the roomId of the created room from above. We suggest copying the videoChat.php file to a relevant place in your app and using the ?roomId=xxx URL parameter for a super quick start.
The Video/ Audio/ Data peer-to-peer connection is done in a single Javascript/ jQuery command, JoinRoom
Call JoinRoom with the userId and roomName to connect the users with WebRTC
Javascript
JoinRoom({
	localVideo:'localVideo',
	remoteVideo:'remoteVideo',
	roomName:"roomId",
	userId:"userId",
	muteAudioBtn:$('#muteAudioBtn'),
	muteVideoBtn:$('#muteVideoBtn'),
	callBtn:$(".callPeerBtn"),
	onMessage: function(type, data) {
		if(type == "sharedLink") {
			//Custom message handlers for peer-to-peer communication
			alert("A link was shared with you to: " + data);
		}
	},
	signalMethod:"php",  //Or "pubnub"
	pubnubSubscribeKey:"optional",
	pubnubPublishKey:"optional",
	roomNotFoundCallback: function() {
		
	}
});
Video/ Audio streaming and sharing is automatically configured and shared between the authorized users. Developers get the sendMessage JavaScript function to send any type of string or JSON data between the users.
sendMessage takes two parameters: type(string) and data (string or object) and passes this to the other client:
Javascript
sendMessage("changedDrawing", {"circles":[], "rectangles":[], "triangles":[], "bgColor":"blue"});
sendMessage("shareLink", "https://YoureFree.com");
See the full docs for BlueCam.js for more information.