Last active
          November 14, 2022 17:40 
        
      - 
      
- 
        Save yakovenkodenis/df357a13442bf6d5203fc582f7f18fde to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | _init() { | |
| if (this._server) throw new Error('Server already initialized'); | |
| this._server = http.createServer((req, res) => { | |
| const UPGRADE_REQUIRED = 426; | |
| const body = http.STATUS_CODES[UPGRADE_REQUIRED]; | |
| res.writeHead(UPGRADE_REQUIRED, { | |
| 'Content-Type': 'text/plain', | |
| 'Upgrade': 'WebSocket', | |
| }); | |
| res.end(body); | |
| }); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment