Implementation Examples

In Godot

HTTPClient
HTTPRequest
  • *Considerations:

    • The node needs to be instanced in the SceneTree. It must be a child of another node.

  • Multiple Requests:

    • You have to wait for a request to finish before sending another one.

    • Making multiple requests at once requires one node per request.

    • A common strategy is to create and delete HTTPRequest nodes at runtime as needed.

TLS/SSL Certificates
  • "It is often desired to use TLS connections (also known as SSL connections) for communications to avoid 'man in the middle' attacks. Godot has a connection wrapper, StreamPeerTLS, which can take a regular connection and add security around it. The HTTPClient and HTTPRequest classes also support HTTPS using this same wrapper."

  • TLS/SSL Certificates .

Examples

In Python

  • Use 'Flask'.

Example
from flask import Flask, jsonify

app = Flask(__name__)

@app.route('/api/todos', methods=['GET'])
def get_todos():
    return jsonify([{"id": 1, "title": "Buy milk", "completed": False}])

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=<port>)