[prev in list] [next in list] [prev in thread] [next in thread] 

List:       flightgear-devel
Subject:    [Flightgear-devel] [nasal] http post request and Web sockets support
From:       www2 <www2 () worldwideweb2 ! nl>
Date:       2015-10-28 17:21:22
Message-ID: 56310412.5040307 () worldwideweb2 ! nl
[Download RAW message or body]


Hi i want to ask for adding for adding http post request and websockets.

First Http post requests.
This is a extension for the current http.load() and http.save()
methode that a a new optional field call post that use a array for
input that is standard a empty array.
Some example code.

var postRequest = {
~ var foo = 'eggs',
~ var bar = 'spam',
};
http.load("http://example.com/test.php", post = postRequest)
~    .done(func(r) print("Got response: " ~ r.response));

This script send variable foo and bar to http://example.com/test.php
using a post request.


Second, Websockets support
Websockets[1] are full-duplex communication over http (ws://) and
https (wss://) connections for retrieving information as real time
lighting data[1].

Some example code:

#setup new connetion
WStest = ws.new('wss://example.com/websocket:455');
#setup a handler for response form the server server
WStest.set_handeler(func(r) print(r.response));
#connect to the server
WStest.run();
# send data to the server
WStest.send('hello Flight Gear')
#close the connection to the server after 10 sec.
settimer(func(WStest.close()),10);


Jean-Paul Anceaux (www2 on the forums and irc)

[1] https://en.wikipedia.org/wiki/WebSocket
[2] http://www.blitzortung.org

edit i send this a second time because sf.net block my mail i forgot 
turn off my GPG signature.

------------------------------------------------------------------------------
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic