//Send Notification let ctrl = {}; ctrl.Send = function (receiver, message, url, note, type, onResponse) { let args = [receiver, message, type, url, note]; cfg.Connector.Submit(args, "ardvro/wf/sqljson/NotificationWorkflow/Send", function (box) { onResponse != null ? onResponse(box == null ? null : box.Data) : null; }); }; ctrl.UpdateStatus = function (id, status, onResponse) { let args = [id, status]; cfg.Connector.Submit(args, "ardvro/component/sqljson/NotificationController/UpdateStatus", function (box) { onResponse != null ? onResponse(box == null ? null : box.Data) : null; }); }; ctrl.CountUserNotification = function (onResponse) { cfg.Connector.Submit([], "ardvro/wf/sqljson/NotificationWorkflow/CountUserNotification", function (box) { onResponse != null ? onResponse(box == null ? null : box.Data) : null; }); }; ctrl.GetUserNotifications = function (pageIndex, pageSize, onResponse) { cfg.Connector.Submit([pageIndex, pageSize], "ardvro/wf/sqljson/NotificationWorkflow/GetUserNotifications", function (box) { onResponse != null ? onResponse(box == null ? null : box.Data) : null; }); }; ctrl.Broadcast = function (flex, onResponse) { cfg.Connector.Submit(flex, "ardvro/wf/sqljson/NotificationWorkflow/Broadcast", function (box) { onResponse != null ? onResponse(box == null ? null : box.Data) : null; }); }; ctrl.IsOnline = function (username, callback) { cfg.Connector.Submit(username, "ardvro/component/sqljson/NotificationController/IsOnline", function (box) { callback != null ? callback(box == null ? null : box.Data) : null; }); }; //Handle Incoming Notification. let _connector = new WebSocketClient(cfg.DocumentationWsData); _connector.Open(onConnectionConfirmedHandler, onUnrequestedDataReceivedHandler, onConnectionClosedHandler); function onUnrequestedDataReceivedHandler(box) { //_notificator //Do what your system need to do if (box == null) { return; } //however, we already have a context to dealt with it in Web Application environment. //If you use our Website Framework, then you only need to create a Listener, please revert to documentations page for detail. let listener = _notificationListeners.find(x => box.Function.startsWith(x.Function)); if (listener != null) { if (listener.Instance != null && listener.Instance.Notify != null) { listener.Instance.Notify(box); } } }