Ticket-based Authentication
'use strict';
/**
* Ticket authentication
*/
wampy = new Wampy('wss://wamp.router.url', {
realm: 'realm1',
authid: 'joe',
authmethods: ['ticket'],
onChallenge: (method, info) => {
console.log('Requested challenge with ', method, info);
return 'joe secret key or password';
}
});
/**
* Promise-based ticket authentication
*/
wampy = new Wampy('wss://wamp.router.url', {
realm: 'realm1',
authid: 'micky',
authmethods: ['ticket'],
onChallenge: (method, info) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
console.log('Requested challenge with ', method, info);
resolve('micky secret key or password');
}, 2000);
});
}
});Last updated