* Set the authentication timeout for the socket.
(ws: WebSocket)
| 819 | * Set the authentication timeout for the socket. |
| 820 | */ |
| 821 | protected setUserAuthenticationTimeout(ws: WebSocket): void { |
| 822 | ws.userAuthenticationTimeout = setTimeout(() => { |
| 823 | ws.sendJson({ |
| 824 | event: 'pusher:error', |
| 825 | data: { |
| 826 | code: 4009, |
| 827 | message: 'Connection not authorized within timeout.', |
| 828 | }, |
| 829 | }); |
| 830 | |
| 831 | try { |
| 832 | ws.end(4009); |
| 833 | } catch (e) { |
| 834 | // |
| 835 | } |
| 836 | }, this.server.options.userAuthenticationTimeout); |
| 837 | } |
| 838 | } |