Help with send data to a local server

I am attempting to report live data to a local server but have been unable to figure out the best way to do it or if the method from the documentation works. I am used to java and python but am more or less a beginner. I am aware that the data passes to the phone.

if also possible to send to a specific port and using udp with a parameter name and value.

  • And unless the server is actually running on your phone, you want to use https and a certificate that works (not self signed if I recall)

  • I've never needed HTTPS on a local server.

  • A Windows PC. I can use my app to access a file server running on a Windows PC.

  • So, wifi on an Edge Device.  With watches, they generally use GCM and a phone.  Wifi is rarely connected on a watch.

  • I am still confused? The server is ran on a local pc running flask (REST API) to receive the values CDL and CV. The server is verified to work with other things. The watch keeps sending back a responseCode 300 no matter what I can think of changing. What am I doing wrong??? I know something like this is possible?

    Code Snippets

     FLASK Server written in Python

    from flask import Flask, jsonify, request, json

    api = Flask(__name__)

    @api.route('/endpoint')
    def home():
        print(request.args) #the key/value pairs in the URL query string
        print(request.form) #the key/value pairs in the body, from a HTML post form, or JavaScript request that isn't JSON encoded
        print(request.values) #combined args and form, preferring args if keys overlap
        print(request.get_json(force=True)) #parsed JSON data. The request must have the application/json content type, or use request.get_json(force=True) to ignore the content type.
        return "Hello! this is the main page <h1>HELLO<h1>", 200

    @api.route('/endpoint', methods=['GET','POST'])
    def endpoint():
        print(request.args) #the key/value pairs in the URL query string
        print(request.form) #the key/value pairs in the body, from a HTML post form, or JavaScript request that isn't JSON encoded
        print(request.values) #combined args and form, preferring args if keys overlap
        print(request.get_json(force=True)) #parsed JSON data. The request must have the application/json content type, or use request.get_json(force=True) to ignore the content type.
        return json.dumps({"success": True}), 200

    if __name__ == '__main__':
        api.run(host="tldweb", port=5000)
    Watch CODE (comm snippet)
    public function onReceive(responseCode as Number, data as Dictionary<String, Object?> or String or Null) as Void {
            if (responseCode == 200) {
                _log = "Msg Sent!";
            }
            else {
                _log = "Msg Fail: " + responseCode;
            }

        }

        private function makeRequests() as Void {
            var url = "">http://tldweb:5000/endpoint";                         // set the url
            //10.83.1.103
            //http://tldweb.local
            var params = {                                              // set the parameters
                    "CDL" => _CDLString,
                    "CV" => _CVString
            };

            var options = {                                             // set the options
                :method => Communications.HTTP_REQUEST_METHOD_POST,      // set HTTP method
                :headers => {                                           // set headers
                        "Content-Type" => Communications.REQUEST_CONTENT_TYPE_JSON},
                                                                        // set response type
                :responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_JSON
            };

            var responseCallback = method(:onReceive);                  // set responseCallback to
                                                                        // onReceive() method
            // Make the Communications.makeWebRequest() call
            Communications.makeWebRequest(url, params, options, method(:onReceive));
        }
  • What does the output look like?

  • Ok so fixed a few things and testing the code in the simulator on my pc the code and everything works but when loaded onto the watch it doesnt work and provides the 300 code