API Usage
Creating a whiteboard
Insert this tag in your website where you want to have the whiteboard.
Just pasting the tag will not work! Read the parameter description or the
examples
below.
<iframe src="http://cosketch.com/Embed?apikey=apiKey&room=roomName&user=userName&sig=signature&seq;=timeStamp"
frameborder="0" style="width: 756px; height: 607px; background: #fff; margin:0;
padding:0; border: 4px solid #000;"></iframe>
Parameter description
apiKey - Unique key to identify your website, given to you when you registered.
roomName - A name picked by you that identifies the room (max 20 alphanumerical
characters). Rooms are created automatically if they are empty and you can create
as many as you want.
userName - The name of the user logged in on your website. This is used as
both identifier and displayname, if two users with the same name is logged in the
first one will get disconnected.
timeStamp - Standardized timestamp. Number of seconds since Unix Epoch (January
1 1970 00:00:00 GMT). Must be accurate to +/- 5 minutes of cosketch server time.
Cosketch time is now
2023-11-06 14:12:50 (UTC without daylight saving)
signature - One-time signature, generated by you, used to validate that the
creation of the whiteboard in fact was done on your website with the correct user
logged in.
This should be calculated, every time you display a whiteboard, on your server,
as:
sha1(apiKey + roomName + userName + privateKey + timeStamp)
Where + is normal string concatenation.
The sha1-hash should be represented as a 40-character hexadecimal number-string.
Example - PHP
Replace the highlighted fields with the keys given to you and a chosen roomname
and the name of the user logged in.
$apiKey = "yourApikey";
$privateKey = "yourPrivatekey";
$roomName = "testRoom";
$user = "testUser";
$timeStamp = time();
$signature = sha1($apiKey . $roomName . $user . $privateKey . $timeStamp);
echo('<iframe src="http://cosketch.com/Embed?apikey=' . $apiKey . '&room;=' .
$roomName . '&user;=' . $user . '&sig;=' . $signature . '&seq;=' . $timeStamp
. '" frameborder="0" style="width: 756px; height: 607px; background: #fff; margin:0;
padding:0; border: 4px solid #000;"></iframe>');
Example - ASP.NET with C#
In your aspx-file add this tag where you want the control:
<asp:Literal ID="whiteboard" runat="server" ></asp:Literal>
Codebehind. Replace the highlighted fields with the keys given to you and a chosen roomname
and the name of the user logged in.
string apiKey = "yourApiKey";
string privateKey = "yourPrivateKey";
string roomName = "testRoom";
string user = "testUser";
string timeStamp = DateTime.UtcNow.Ticks.ToString();
string toHash = apiKey + roomName + user + privateKey + timeStamp ;
byte[] toHashArray = System.Text.Encoding.UTF8.GetBytes(toHash);
byte[] hashed = new System.Security.Cryptography.SHA1Managed().ComputeHash(toHashArray);
string hashHex = "";
for (int i = 0; i < hashed.Length; i++)
hashHex += hashed[i].ToString("x2");
whiteboard.Text = "<iframe src=\"http://cosketch.com/Embed?apikey=" + apiKey
+ "&room;=" + roomName + "&user;=" + user + "&sig;=" + hashHex + "&seq;=" + timeStamp
+ "\" frameborder=\"0\" style=\"width: 756px; height: 607px; background: #fff; margin:0;
padding:0; border: 4px solid #000;\"></iframe>";
Result
If you've done everything correct this is what your control should look like: