-
Notifications
You must be signed in to change notification settings - Fork 104
APE Server Private Public and Session Properties
Both Users and Channels can have private and public properties.
Are only seen by the ape server and are not propagated to the client (at least not automatically)
Example:
// Channel private property
var channel = Ape.getChannelByName('foochannel');
channel.booproperty = 'boovalue';
Ape.log(channel.booproperty); // will log boovalue
// User private property (user is an user object)
user.booproperty = 'boovalue';
Ape.log(user.booproperty); // will log boovalue
Are automatically propagated to the client
Example:
// Channel public property
var channel = Ape.getChannelByName('foochannel');
channel.setProperty('booproperty', 'boovalue');
Ape.log(channel.getProperty('booproperty'); // will log boovalue
// User public property (user is an user object)
user.setProperty('booproperty','boovalue');
Ape.log(user.getProperty('booproperty'); // will log boovalue
After a public property has been set on the APE server, each time a client is informed about a user or a channel, the property will be listed in the raw received by the client.
Public properties are used to give users or channels a public property, that is a name, status, image url, or whatever. All clients will be informed about these properties and can do something with these properties.
don't accidentally create public properties if the data should not be shared with other users, use private properties instead.
So don't use user.setProperty('bankAccount', '123254567');
As this will be seen by all other users!
(requires using the coreSession.js client instead of the default client: APE_JSF Sessions)
Session properties are used to store data for the client to which the session belongs. They can be regarded as "protected" variables, only the client with the accompanying session can read the session data.
example:
todo
TODO
- Real word use cases:
- Can Ape server read session variables?
- Is the above info correct?
- write example