Created
          December 14, 2021 00:59 
        
      - 
      
- 
        Save ono-max/8817a031f6b3a37373fc2345a6385250 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
    
  
  
    
  | Socket.tcp_server_sockets "127.0.0.1", 9229 do |socks| | |
| Socket.accept_loop(socks) do |sock, client| | |
| while l = sock.gets | |
| p l | |
| case l | |
| when /^GET \/json\/version HTTP\/1.1/ | |
| sock.print "HTTP/1.0 200 OK\r\nContent-Type: application/json; charset=UTF-8\r\nCache-Control: no-cache\r\nContent-Length: 64\r\n\r\n{\n \"Browser\": \"node.js/v17.0.1\",\n \"Protocol-Version\": \"1.1\"\n} " | |
| when /^GET \/json HTTP\/1.1/ | |
| sock.print "HTTP/1.0 200 OK\r\nContent-Type: application/json; charset=UTF-8\r\nCache-Control: no-cache\r\nContent-Length: 660\r\n\r\n[ {\n \"description\": \"node.js instance\",\n \"devtoolsFrontendUrl\": \"devtools://devtools/bundled/js_app.html?experiments=true&v8only=true&ws=127.0.0.1:9229/5e7fe95a-33c8-4035-a11a-de9f5845840a\",\n \"devtoolsFrontendUrlCompat\": \"devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/5e7fe95a-33c8-4035-a11a-de9f5845840a\",\n \"faviconUrl\": \"https://nodejs.org/static/images/favicons/favicon.ico\",\n \"id\": \"5e7fe95a-33c8-4035-a11a-de9f5845840a\",\n \"title\": \"module.js\",\n \"type\": \"node\",\n \"url\": \"file:///Users/naotto/workspace/module.js\",\n \"webSocketDebuggerUrl\": \"ws://127.0.0.1:9229/5e7fe95a-33c8-4035-a11a-de9f5845840a\"\n} ]\n\n" | |
| end | |
| end | |
| p 'socket closed' | |
| sock.close | |
| end | |
| end | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment