<< Click to Display Table of Contents >> Navigation: Technical Documentation > OpenAir SDK > OnAir API |
The HTTP API is described by the WebService itself at: http://[webservice-url]/Help
List of functions:
API |
Description |
GET api/OnAir/GetHubUrl |
retrieves the OnAirHub SignalR URL used by clients |
GET api/OnAir/GetDDODictionnary |
retrieves the AirDDO list monitored by the service |
GET api/OnAir/GetDDOList |
for backward compatibility - use GetDDODictionnary |
POST api/OnAir/SubscribeDDO |
Subscribe to the AirDDO to receive notifications over the OnAirHub |
POST api/OnAir/GetDDOConnectionState |
Gives the connection state of AirDDO |
POST api/OnAir/GetDDOConfiguration |
Gets the tracks configuration of the AirDDO |
POST api/OnAir/DragnDrop |
Drag and Drop an item from a cart to another |
POST api/OnAir/MoveItem |
Move an item in a channel |
POST api/OnAir/InsertItem |
Insert an item from database into the specified cart |
POST api/OnAir/ReplaceItem |
Replace an item from database into the specified cart |
POST api/OnAir/RemoveItem |
Remove item at the specified cart |
POST api/OnAir/UnloadItem |
Unload the specified cart |
POST api/OnAir/LoadCart |
Load a cartouchier at the specified channel |
POST api/OnAir/GetItemToLoop |
Set item loop mode |
POST api/OnAir/GetItemToChain |
Set item chain mode |
POST api/OnAir/GetItemToPFL |
Request PFL for specified cart |
POST api/OnAir/GetDDOChannel |
Request to get notification InfosItem |
POST api/OnAir/GetStructPlaylist |
Get the playlist content of the specified channel |
POST api/OnAir/GetDDOToStop |
Stop the specified channel |
POST api/OnAir/GetDDOToPlay |
Play the specified channel |
POST api/OnAir/GetDDOToPlayCart |
Play the specified cart |
POST api/OnAir/GetOnAir |
Get the current on air status |
POST api/OnAir/StayinAlive |
Keep service alive (used through a timer) |
POST api/OnAir/GetUiUpdate |
Get the status of the UI |
POST api/OnAir/GetChannelUpdate |
Get status of the specified channel |
GET api/OnAir/GetHubUrl
retrieves the OnAirHub SignalR URL used by clients
Request Information
URI Parameters
None.
Body Parameters
None.
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
GET api/OnAir/GetDDODictionnary
retrieves the AirDDO list monitored by the service
Request Information
URI Parameters
None.
Body Parameters
None.
Response Information
Resource Description
Collection of DDOIdentity
Name |
Description |
Type |
Additional information |
---|---|---|---|
GUID |
Unique identifier of the AirDDO connection |
globally unique identifier |
None. |
Name |
Name of the AirDDO provided in the configuration |
string |
None. |
Response Formats
application/json, text/json
Sample:
[
{
"GUID": "30baf26d-a137-4eb5-9d2e-ae8f79cf1694",
"Name": "sample string 2"
},
{
"GUID": "30baf26d-a137-4eb5-9d2e-ae8f79cf1694",
"Name": "sample string 2"
}
]
GET api/OnAir/GetDDOList
for backward compatibility - use GetDDODictionnary
Request Information
URI Parameters
None.
Body Parameters
None.
Response Information
Resource Description
Collection of DDOIdentity
Name |
Description |
Type |
Additional information |
---|---|---|---|
GUID |
Unique identifier of the AirDDO connection |
globally unique identifier |
None. |
Name |
Name of the AirDDO provided in the configuration |
string |
None. |
Response Formats
application/json, text/json
Sample:
[
{
"GUID": "772ee903-68f8-4855-8135-7fdbe65efcc8",
"Name": "sample string 2"
},
{
"GUID": "772ee903-68f8-4855-8135-7fdbe65efcc8",
"Name": "sample string 2"
}
]
POST api/OnAir/SubscribeDDO
Subscribe to the AirDDO to receive notifications over the OnAirHub
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
ddoid |
Unique identifier of the AirDDO connection |
globally unique identifier |
None. |
connectionId |
Unique identifier of the OnAirHub connection to subscribe |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"ddoid": "d0cc96d6-5802-4d3a-b1b6-0dfae6c28c6d",
"connectionId": "sample string 2"
}
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/GetDDOConnectionState
Gives the connection state of AirDDO
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
Channel |
Index of the Channel |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"ddoid": "sample string 1",
"Channel": "sample string 2"
}
Response Information
Resource Description
Name |
Description |
Type |
Additional information |
---|---|---|---|
State |
Connection state of OnAir on DDOHub SignalR |
string |
None. |
DDO |
Connection state of the AirDDO on DDOHub SignalR |
string |
None. |
Response Formats
application/json, text/json
Sample:
{
"State": "sample string 1",
"DDO": "sample string 2"
}
POST api/OnAir/GetDDOConfiguration
Gets the tracks configuration of the AirDDO
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
Channel |
Index of the Channel |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"ddoid": "sample string 1",
"Channel": "sample string 2"
}
Response Information
Resource Description
json string array of integral values
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/DragnDrop
Drag and Drop an item from a cart to another
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
ChannelOrg |
Channel source |
string |
None. |
NumcartOrg |
Cart source |
string |
None. |
ChannelDest |
Channel destination |
string |
None. |
NumcartDest |
Cart destination |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"ddoid": "sample string 1",
"ChannelOrg": "sample string 2",
"NumcartOrg": "sample string 3",
"ChannelDest": "sample string 4",
"NumcartDest": "sample string 5"
}
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/MoveItem
Move an item in a channel
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
Offset |
Move offset |
string |
None. |
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
Channel |
Index of the Channel |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"Offset": "sample string 1",
"ddoid": "sample string 2",
"Channel": "sample string 3"
}
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/InsertItem
Insert an item from database into the specified cart
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
guid_item |
Guid of the item in database |
string |
None. |
track_num_dest |
Channel index |
string |
None. |
cart_num_dest |
Cart index |
string |
None. |
insert_mod |
Type of insertion mode - unused, always before |
string |
None. |
item |
JSON item tuple |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"ddoid": "sample string 1",
"guid_item": "sample string 2",
"track_num_dest": "sample string 3",
"cart_num_dest": "sample string 4",
"insert_mod": "sample string 5",
"item": "sample string 6"
}
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/ReplaceItem
Replace an item from database into the specified cart
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
guid_item |
Guid of the item in database |
string |
None. |
track_num_dest |
Channel index |
string |
None. |
cart_num_dest |
Cart index |
string |
None. |
insert_mod |
Type of insertion mode - unused, always before |
string |
None. |
item |
JSON item tuple |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"ddoid": "sample string 1",
"guid_item": "sample string 2",
"track_num_dest": "sample string 3",
"cart_num_dest": "sample string 4",
"insert_mod": "sample string 5",
"item": "sample string 6"
}
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/RemoveItem
Remove item at the specified cart
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
guid_item |
Guid of the item in database |
string |
None. |
track_num_dest |
Channel index |
string |
None. |
cart_num_dest |
Cart index |
string |
None. |
insert_mod |
Type of insertion mode - unused, always before |
string |
None. |
item |
JSON item tuple |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"ddoid": "sample string 1",
"guid_item": "sample string 2",
"track_num_dest": "sample string 3",
"cart_num_dest": "sample string 4",
"insert_mod": "sample string 5",
"item": "sample string 6"
}
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/UnloadItem
Unload the specified cart
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
guid_item |
Guid of the item in database |
string |
None. |
track_num_dest |
Channel index |
string |
None. |
cart_num_dest |
Cart index |
string |
None. |
insert_mod |
Type of insertion mode - unused, always before |
string |
None. |
item |
JSON item tuple |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"ddoid": "sample string 1",
"guid_item": "sample string 2",
"track_num_dest": "sample string 3",
"cart_num_dest": "sample string 4",
"insert_mod": "sample string 5",
"item": "sample string 6"
}
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/LoadCart
Load a cartouchier at the specified channel
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
guid_item |
Guid of the item in database |
string |
None. |
track_num_dest |
Channel index |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"ddoid": "sample string 1",
"guid_item": "sample string 2",
"track_num_dest": "sample string 3"
}
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/GetItemToLoop
Set item loop mode
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
Numcart |
Cart Index |
string |
None. |
Do |
enabled when "1", disabled otherwise |
string |
None. |
Mode |
Mode to apply |
string |
None. |
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
Channel |
Index of the Channel |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"Numcart": "sample string 1",
"Do": "sample string 2",
"Mode": "sample string 3",
"ddoid": "sample string 4",
"Channel": "sample string 5"
}
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/GetItemToChain
Set item chain mode
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
Numcart |
Cart Index |
string |
None. |
Do |
enabled when "1", disabled otherwise |
string |
None. |
Mode |
Mode to apply |
string |
None. |
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
Channel |
Index of the Channel |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"Numcart": "sample string 1",
"Do": "sample string 2",
"Mode": "sample string 3",
"ddoid": "sample string 4",
"Channel": "sample string 5"
}
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/GetItemToPFL
Request PFL for specified cart
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
Numcart |
Cart Index |
string |
None. |
Do |
enabled when "1", disabled otherwise |
string |
None. |
Mode |
Mode to apply |
string |
None. |
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
Channel |
Index of the Channel |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"Numcart": "sample string 1",
"Do": "sample string 2",
"Mode": "sample string 3",
"ddoid": "sample string 4",
"Channel": "sample string 5"
}
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/GetDDOChannel
Request to get notification InfosItem
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
Channel |
Index of the Channel |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"ddoid": "sample string 1",
"Channel": "sample string 2"
}
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/GetStructPlaylist
Get the playlist content of the specified channel
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
Channel |
Index of the Channel |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"ddoid": "sample string 1",
"Channel": "sample string 2"
}
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/GetDDOToStop
Stop the specified channel
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
Channel |
Index of the Channel |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"ddoid": "sample string 1",
"Channel": "sample string 2"
}
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/GetDDOToPlay
Play the specified channel
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
Channel |
Index of the Channel |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"ddoid": "sample string 1",
"Channel": "sample string 2"
}
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/GetDDOToPlayCart
Play the specified cart
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
Numcart |
Cart Index |
string |
None. |
Do |
enabled when "1", disabled otherwise |
string |
None. |
Mode |
Mode to apply |
string |
None. |
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
Channel |
Index of the Channel |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"Numcart": "sample string 1",
"Do": "sample string 2",
"Mode": "sample string 3",
"ddoid": "sample string 4",
"Channel": "sample string 5"
}
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/GetOnAir
Get the current on air status
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
Channel |
Index of the Channel |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"ddoid": "sample string 1",
"Channel": "sample string 2"
}
Response Information
Resource Description
Collection of StatusMessage
Name |
Description |
Type |
Additional information |
---|---|---|---|
DDO_ID |
|
string |
None. |
CHANNEL |
|
integer |
None. |
NUM_CART |
|
integer |
None. |
STATUS |
|
string |
None. |
GUID_RUN |
|
string |
None. |
STRING_1 |
|
string |
None. |
STRING_2 |
|
string |
None. |
TYPE_ITEM |
|
integer |
None. |
TYPE1_ITEM |
|
integer |
None. |
OUTRO |
|
string |
None. |
INTRO |
|
string |
None. |
GUID_LOG |
|
string |
None. |
GUID_ITEM |
|
string |
None. |
Response Formats
application/json, text/json
Sample:
[
{
"DDO_ID": "sample string 1",
"CHANNEL": 2,
"NUM_CART": 1,
"STATUS": "sample string 3",
"GUID_RUN": "sample string 4",
"STRING_1": "sample string 5",
"STRING_2": "sample string 6",
"TYPE_ITEM": 7,
"TYPE1_ITEM": 8,
"OUTRO": "sample string 9",
"INTRO": "sample string 10",
"GUID_LOG": "sample string 11",
"GUID_ITEM": "sample string 12"
},
{
"DDO_ID": "sample string 1",
"CHANNEL": 2,
"NUM_CART": 1,
"STATUS": "sample string 3",
"GUID_RUN": "sample string 4",
"STRING_1": "sample string 5",
"STRING_2": "sample string 6",
"TYPE_ITEM": 7,
"TYPE1_ITEM": 8,
"OUTRO": "sample string 9",
"INTRO": "sample string 10",
"GUID_LOG": "sample string 11",
"GUID_ITEM": "sample string 12"
}
]
POST api/OnAir/StayinAlive
Keep service alive (used through a timer)
Request Information
URI Parameters
None.
Body Parameters
None.
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/GetUiUpdate
Get the status of the UI
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
Channel |
Index of the Channel |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"ddoid": "sample string 1",
"Channel": "sample string 2"
}
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
POST api/OnAir/GetChannelUpdate
Get status of the specified channel
Request Information
URI Parameters
None.
Body Parameters
Name |
Description |
Type |
Additional information |
---|---|---|---|
ddoid |
Unique identifier of the AirDDO connection |
string |
None. |
Channel |
Index of the Channel |
string |
None. |
Request Formats
application/json, text/json
Sample:
{
"ddoid": "sample string 1",
"Channel": "sample string 2"
}
Response Information
Resource Description
string
Response Formats
application/json, text/json
Sample:
"sample string 1"
OnAirHub (SignalR)
Liste des fonctions :
API |
Description |
PlaylistMessage |
the full playlists in conduct (usually sent on update) |
InOutroCounter |
counters for Intro/Outro |
MainCounter |
main counter |
FocusMessage |
guid_run of a channel's new focus |
ConnectionStatus |
information on a AirDDO connection status change |
TrackStatusMessage |
status (play/pause/run) and information (name, guid...) of a track |
OnAirInfoItem |
all data on an ui cart change |
ItemStatusMessage |
status (play/pause/run) and information (name, guid, numcart...) of an item |
HTML/JS exemple
<!DOCTYPE html>
<html>
<head>
<title>SignalR Simple Chat</title>
<style type="text/css">
.container {
background-color: #99CCFF;
border: thick solid #808080;
padding: 20px;
margin: 20px;
}
.channel {
font-size:36px;
font-weight:bold;
}
.discussion {
font-size: 20px;
}
</style>
</head>
<body>
<div><a href="Help">API reference</a></div>
<div>Connection Id: <span id="connection_id"></span></div>
<div class="container">
<select id="ddo"></select><div>DDO ID: <span id="ddo_id"></span></div>
<div id="channel1" class="channel">
<span>Channel 1</span>
<div id="main-counter" class="discussion"></div>
<div id="inoutro-counter" class="discussion"></div>
</div>
<div id="channel2" class="channel">
<span>Channel 2</span>
<div id="main-counter" class="discussion"></div>
<div id="inoutro-counter" class="discussion"></div>
</div>
<div id="channel3" class="channel">
<span>Channel 3</span>
<div id="main-counter" class="discussion"></div>
<div id="inoutro-counter" class="discussion"></div>
</div>
<div id="channel4" class="channel">
<span>Channel 4</span>
<div id="main-counter" class="discussion"></div>
<div id="inoutro-counter" class="discussion"></div>
</div>
<button onclick="GetStructPlaylist()">GetStructPlaylist</button>
<select id="playlist_channel">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<div id="playlist" class="discussion"></div>
</div>
<!--Script references. -->
<!--Reference the jQuery library. -->
<script src="Scripts/jquery-3.3.1.min.js"></script>
<!--Reference the SignalR library. -->
<script src="Scripts/jquery.signalR-2.2.3.min.js"></script>
<!--Add script to update the page and send messages.-->
<script type="text/javascript">
function getRestUrl(action) {
return location.href + "api/OnAir/" + action;
}
// gets the hub url
function getHubUrl()
{
var hubUrl = "";
jQuery.ajax({
type: "GET",
url: getRestUrl("GetHubUrl"),
success: function (data, status, jqXHR) {
console.log(data);
hubUrl = data;
},
error: function (xhr) {
alert(xhr.responseText);
},
async: false
});
return hubUrl;
}
setInterval(getHubUrl, 60000);
var hubUrl = getHubUrl();
// load hubs script
$.getScript(hubUrl + "/hubs", loadHub);
function loadHub() {
// Declare a proxy to reference the hub.
var chat = $.connection.onairHub;
// define the correct hub url routing
$.connection.hub.url = hubUrl;
chat.client.ChangeItem = function (name, message) {
console.log(JSON.parse(message));
};
chat.client.MockMessage = function (name, message) {
console.log(message);
};
// Create a function that the hub can call to broadcast messages.
chat.client.MainCounter = function (name, message) {
// Html encode display name and message.
var encodedName = $('<div />').text(name).html();
var encodedMsg = $('<div />').text(message).html();
// Add the message to the page.
$("#channel" + JSON.parse(message).Channel).find('#main-counter').html('<strong>' + encodedName
+ '</strong>: ' + encodedMsg);
};
chat.client.InOutroCounter = function (name, message) {
// Html encode display name and message.
var encodedName = $('<div />').text(name).html();
var encodedMsg = $('<div />').text(message).html();
// Add the message to the page.
$("#channel" + JSON.parse(message).Channel).find('#inoutro-counter').html('<strong>' + encodedName
+ '</strong>: ' + encodedMsg);
};
chat.client.ConnectionStatus = function (name, message) {
console.log(message);
};
chat.client.PlaylistMessage = function (name, message) {
console.log(message);
};
chat.client.ItemStatusMessage = function (name, message) {
console.log(message);
};
chat.client.TrackStatusMessage = function (name, message) {
console.log(message);
};
// Get the user name and store it to prepend to messages.
//$('#displayname').val(prompt('Enter your name:', ''));
// Set initial focus to message input box.
$('#message').focus();
// Start the connection.
$.connection.hub.start().done(function () {
console.log("id : %o", $.connection.hub.id);
$("#connection_id").text($.connection.hub.id);
$('#sendmessage').click(function () {
// Call the Send method on the hub.
chat.server.send($('#displayname').val(), $('#message').val());
// Clear text box and reset focus for next comment.
$('#message').val('').focus();
});
// update of DDO select
jQuery.ajax({
type: "GET",
url: getRestUrl("GetDDODictionnary"),
success: function (data, status, jqXHR) {
console.log(data);
var obj = (data);
$("#ddo").empty();
$("#ddo").append($("<option>"));
for (var key in obj) {
var ddo = obj[key];
$("#ddo").append($("<option>").attr("value", ddo.GUID).text(ddo.Name));
}
},
error: function (xhr) {
alert(xhr.responseText);
}
});
// add subscription
$("#ddo").change(function () {
//alert("Handler for .change() called.");
jQuery.ajax({
type: "POST",
url: getRestUrl("SubscribeDDO"),
data: JSON.stringify({
ddoid: $(this).val(),
connectionid: $.connection.hub.id
}),
contentType: "application/json",
success: function (data, status, jqXHR) {
console.log(data);
},
error: function (xhr) {
alert(xhr.responseText);
}
});
$("#ddo_id").text($(this).val());
});
});
}
function GetStructPlaylist() {
jQuery.ajax({
type: "POST",
url: getRestUrl("GetStructPlaylist"),
data: JSON.stringify({
ddoid: $("#ddo").val(),
Channel: $("#playlist_channel").val()
}),
contentType: "application/json",
success: function (data, status, jqXHR) {
console.log(data);
$("#playlist").text((data));
},
error: function (xhr) {
alert(xhr.responseText);
}
});
}
</script>
</body>
</html>