CODENERIX POS example websocket
<script type="text/javascript" src="/static/codenerix/lib/jquery/jquery.js"></script>  

<script type="text/javascript" src="/static/codenerix_extensions/lib/crypto-js/core.js"></script>  
<script type="text/javascript" src="/static/codenerix_extensions/lib/crypto-js/sha256.js"></script>  
<script type="text/javascript" src="/static/codenerix_extensions/lib/crypto-js/enc-base64.js"></script>  
<script type="text/javascript" src="/static/codenerix_extensions/lib/crypto-js/cipher-core.js"></script>  
<script type="text/javascript" src="/static/codenerix_extensions/lib/crypto-js/aes.js"></script>  
<script type="text/javascript" src="/static/codenerix_extensions/js/cryptography.js"></script>  

<script type="text/javascript" src="/static/codenerix_extensions/lib/reconnecting-websocket/reconnecting-websocket.js"></script>  
<script type="text/javascript" src="/static/codenerix_extensions/js/websocket.js"></script>  

<script type="text/javascript">
$(function() {
    
    var ws = new CodenerixWebsocket(
            "{{WEBSOCKET_URL}}",
            "codenerix_pos/",
            "11111111-2222-3333-4444-555555555555",
            "12345678901234567890123456789012",
            );

    // Prepare debugger
    ws.set_name("POSWebSocket Example")
    ws.set_debug();

    // Define opener
    ws.opened = function () {
        ws.debug("WebSocket CONNECTED");
        ws.debug("Requesting get_config to check authentication as well");
        ws.send({'action': 'get_config'}, null);
    };

    // Define receiver
    ws.recv = function(message, ref) {

        ws.debug("Got message: " + JSON.stringify(message) + " (REF: "+ref+")");
        var action = message.action;

        if (action == 'ping') {
            ws.debug("Sending PONG "+message.ref+" (ref:"+ref+")");
            ws.send({'action': 'pong'}, ref);
        } else if (action == 'config') {
            ws.warning("Got config: "+JSON.stringify(message)+" (ref:"+ref+")");
        } else {
            ws.send_error("Unknown action '"+action+"'", ref);
        }

    };

    // Start websocket
    ws.start();
});
</script>
