5 Matching Annotations
  1. Jul 2023
    1. ```js exports.handler = async (event) => { if (event.headers != undefined) { const headers = toLowerCaseProperties(event.headers);

          if (headers['sec-websocket-protocol'] != undefined) {
              const subprotocolHeader = headers['sec-websocket-protocol'];
              const subprotocols = subprotocolHeader.split(',');
      
              if (subprotocols.indexOf('myprotocol') >= 0) {
                  const response = {
                      statusCode: 200,
                      headers: {
                          "Sec-WebSocket-Protocol" : "myprotocol"
                      }
                  };
                  return response;
              }
          }
      }
      
      const response = {
          statusCode: 400
      };
      
      return response;
      

      };function toLowerCaseProperties(obj) { var wrapper = {}; for (var key in obj) { wrapper[key.toLowerCase()] = obj[key]; } return wrapper; } ```

  2. Apr 2023
  3. Jul 2021
  4. datatracker.ietf.org datatracker.ietf.org
    1. Relationship to TCP and HTTP _This section is non-normative._ The WebSocket Protocol is an independent TCP-based protocol. Its only relationship to HTTP is that its handshake is interpreted by HTTP servers as an Upgrade request. By default, the WebSocket Protocol uses port 80 for regular WebSocket connections and port 443 for WebSocket connections tunneled over Transport Layer Security (TLS) [RFC2818].