socketcluster

SocketCluster Middleware HandShake with promise

寵の児 提交于 2019-12-08 01:08:34
问题 Im building an app that serve both http and ws. Users login first over HTTP to a Laravel Server. That returns a JWT that is used to allow login over WS. Ihv added a MIDDLEWARE_HANDSHAKE that gets the token and make a request to Laravel Server to ask if that token is valid and the user has access to WS (Not every logged user is allowed to WS); Client code: var options = { host: '127.0.0.1:3000', query: { source: 'web', token: '', } }; var socket; $.post('http://127.0.0.1:8000/authenticate', {

SocketCluster Middleware HandShake with promise

梦想与她 提交于 2019-12-06 11:35:40
Im building an app that serve both http and ws. Users login first over HTTP to a Laravel Server. That returns a JWT that is used to allow login over WS. Ihv added a MIDDLEWARE_HANDSHAKE that gets the token and make a request to Laravel Server to ask if that token is valid and the user has access to WS (Not every logged user is allowed to WS); Client code: var options = { host: '127.0.0.1:3000', query: { source: 'web', token: '', } }; var socket; $.post('http://127.0.0.1:8000/authenticate', { email: 'chadd01@example.org', password: '1234' }, function(data, textStatus, xhr) { options.query.token