2
1
mirror of https://github.com/Thream/socketio-jwt.git synced 2024-07-21 09:38:31 +02:00

Workaround for node 4

This commit is contained in:
Fabian Arndt 2019-10-14 04:13:25 +02:00
parent 8f2b55a7aa
commit e66148fbb2
4 changed files with 11 additions and 0 deletions

View File

@ -7,6 +7,7 @@ function noQsMethod (options) {
options = xtend(defaults, options);
return (socket) => {
'use strict'; // Node 4.x workaround
const server = this.server || socket.server;
if (!server.$emit) {
@ -144,7 +145,9 @@ function authorize (options, onConnection) {
const auth = xtend(defaults, options);
return (socket, accept) => {
'use strict'; // Node 4.x workaround
let token, error;
const handshake = socket.handshake;
const req = socket.request || socket;
const authorization_header = (req.headers || {}).authorization;
@ -219,6 +222,8 @@ function authorize (options, onConnection) {
}
function getSecret (request, secret, token, callback) {
'use strict'; // Node 4.x workaround
if (typeof secret === 'function') {
if (!token) {
return callback({ code: 'invalid_token', message: 'jwt must be provided' });

View File

@ -1,3 +1,5 @@
'use strict'; // Node 4.x workaround
const express = require('express');
const http = require('http');

View File

@ -1,3 +1,5 @@
'use strict'; // Node 4.x workaround
const express = require('express');
const http = require('http');

View File

@ -1,3 +1,5 @@
'use strict'; // Node 4.x workaround
const express = require('express');
const http = require('http');