quickstart/websocketquickstart.js
function onMessage(data) {
    if (data.type == "utf8") {
        message = JSON.parse(data.utf8Data);
        switch (message.command) {
            case "setJoints":
                console.log("Client has request to add joints: " + message.data);
                nuimotion.jointsTracking = message.data;
                break;

            case "addListener":
                console.log("Client has request to add events: " + message.data);
                if (!nuimotion._eventCallbackDict[message.data]) {
                    nuimotion.addListener(message.data, onEvent);
                }
                break;

            case "addGesture":
                console.log("Client has request to add gestures: " + message.data);
                if (!nuimotion._gestureCallbackDict[message.data]) {
                    nuimotion.addGesture(message.data, onEvent);
                }
                break;
        }
    }
}
function onMessage(data) {
    if (data.type == "utf8") {
        message = JSON.parse(data.utf8Data);
        switch (message.command) {
            case "setJoints":
                console.log("Client has request to add joints: " + message.data);
                nuimotion.jointsTracking = message.data;
                break;

            case "addListener":
                console.log("Client has request to add events: " + message.data);
                if (!nuimotion._eventCallbackDict[message.data]) {
                    nuimotion.addListener(message.data, onEvent);
                }
                break;

            case "addGesture":
                console.log("Client has request to add gestures: " + message.data);
                if (!nuimotion._gestureCallbackDict[message.data]) {
                    nuimotion.addGesture(message.data, onEvent);
                }
                break;
        }
    }
}
function onMessage ( data ) { if ( data . type == "utf8" ) { message = JSON . parse ( data . utf8Data ) ; switch ( message . command ) { case "setJoints" : console . log ( "Client has request to add joints: " + message . data ) ; nuimotion . jointsTracking = message . data ; break ; case "addListener" : console . log ( "Client has request to add events: " + message . data ) ; if ( ! nuimotion . _eventCallbackDict [ message . data ] ) { nuimotion . addListener ( message . data , onEvent ) ; } break ; case "addGesture" : console . log ( "Client has request to add gestures: " + message . data ) ; if ( ! nuimotion . _gestureCallbackDict [ message . data ] ) { nuimotion . addGesture ( message . data , onEvent ) ; } break ; } } }
on message recieved from client
@param data
on message recieved from client