var connection;

function connectSignalRCore() {

    try {

        connection = new signalR.HubConnectionBuilder()

            .withUrl("https://mapleapi.test-bestpriceexecution.com/FinIQSignalRCoreAPIBeta/NotificationHub")
            .configureLogging(signalR.LogLevel.Trace)
            .build();

        connection.start().catch(err => console.error(err.toString()));

        connection.on("ReceiveMessage", (user, message) => {

            console.log("Yes, Got The Data : : ", JSON.parse(user).responseData);

      

        });

    } catch (e) {
        console.log("connectSignalRCore : " + e.message);
    }
}

function callHubCore(ppdDetails) {

    try {
        console.log('ppdDetails :: ', ppdDetails)

        connection.invoke("pushToken", "DemoappOE", globalToken).catch(err => console.error(err.toString()));

        connection.invoke("Send", '{\"PPDetails\":\"' + ppdDetails + '\",\"UserID\": \"DemoappOE\"}').catch(err => console.error(err.toString()));

    } catch (e) {

        console.log("callHubCore : " + e.message);
    }

}