setProperty

Since STATE is very important in real-time communication you can get/set properties on the server-side controllers. Normally you would call a method on the server and pass in a parameter. Then in the server-side method you would set the property. In XSockets you can do this directly from the client without writing a method on the server.

You can only get/set public getters/setters, but you can 'hide' public getters/setter if you want to by adding the NoEventAttribute on the server-side property.

<script>
    var conn = new xsockets.client('ws://localhost:4502', ['chat']);                
    var chat = conn.controller('chat');
    chat.onOpen = function () {
        chat.setProperty('name', 'Uffe');                                    
    }
    conn.open();
</script>

results matching ""

    No results matching ""