2

I have a Google app that runs using GO on the server side and Javascript on the client side. The client generate every certain timestep a javascript object (that could be "stringified") that needs to be sent back to the server and saved as json file. Based on the google app engine documentation it seems that this could achieved with both:

  1. channel api
  2. socket service

but I couldn't find any examples for both of these and also it is not clear to me which one is the best to accomplish the goal. Can anyone help me? Thanks a lot.

Dede
  • 127
  • 1
  • 9
  • If the client is generating data, you can [POST](http://stackoverflow.com/questions/692196/post-request-javascript) the data and the server can handle it with a standard handler. – R Samuel Klatchko May 04 '15 at 16:28
  • with the channel API data is sent from the client to the server by POSTs (or whatever) in any case, so it would not really help. Sockets are not really available on GAE unless you use a VM flavour. – Paul Collingwood May 04 '15 at 16:29
  • Thanks for the comment. I finally solved with a simple POST method implemented in AJAX: – Dede May 08 '15 at 09:08

1 Answers1

0

Maybe this could be useful to someone so here is the way I did that:

saveData : function saveData() {
      var _this = this,
          save = this.shadowRoot.querySelector('#save-data'),
          subData = JSON.stringify(_this.app.userSession);

      save.url="url";
      save.body = subData;
      save.go();
    }
Dede
  • 127
  • 1
  • 9