parameters: (message, seen_request_ids)
docstring: Figure out if this message was sent to the client or to the server.
  
      The data we have does not include directionality (i.e., was this frame
      send from the browser to the server, or vice versa).  Therefore we
      reconstruct the direction through our knowlege of the protocol.
docstring_summary: Figure out if this message was sent to the client or to the server.
docstring_tokens: Figure out if this message was sent to the client or to the server .
function: def infer_direction(message, seen_request_ids):
      """Figure out if this message was sent to the client or to the server.
  
      The data we have does not include directionality (i.e., was this frame
      send from the browser to the server, or vice versa).  Therefore we
      reconstruct the direction through our knowlege of the protocol.
      """
      # The client always includes a request ID, so if the message does not have
      # one, then the server sent it.
      if 'request_id' not in message:
          return 'to client'
      # Responses to requests include the request ID of the original message.
      # The client is the only side that originates requests that include an ID.
      # Therefore, if the message contains a request ID that has been seen
      # before, then it is a reply (from the server) to the first message that
      # contained that ID (which was sent by the client).
      if message['request_id'] in seen_request_ids:
          return 'to client'
      else:
          return 'to server'
function_tokens: def infer_direction ( message , seen_request_ids ) : # The client always includes a request ID, so if the message does not have # one, then the server sent it. if 'request_id' not in message : return 'to client' # Responses to requests include the request ID of the original message. # The client is the only side that originates requests that include an ID. # Therefore, if the message contains a request ID that has been seen # before, then it is a reply (from the server) to the first message that # contained that ID (which was sent by the client). if message [ 'request_id' ] in seen_request_ids : return 'to client' else : return 'to server'