Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
APE Server Private Public and Session Properties
Clone this wiki locally
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)
// 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
// 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.
- Real word use cases:
- Can Ape server read session variables?
- Is the above info correct?
- write example