petserver
This Websocket server performs all PET computations
- class petserver.Application
Bases:
ApplicationTornado websocket application class
- class petserver.PetWebSocketHandler(val1, val2)
Bases:
WebSocketHandlerTornado Websocket Class for PET Server
- check_origin(origin)
Override to enable support for allowing alternate origins.
The
originargument is the value of theOriginHTTP header, the url responsible for initiating this request. This method is not called for clients that do not send this header; such requests are always allowed (because all browsers that implement WebSockets support this header, and non-browser clients do not have the same cross-site security concerns).Should return
Trueto accept the request orFalseto reject it. By default, rejects all requests with an origin on a host other than this one.This is a security protection against cross site scripting attacks on browsers, since WebSockets are allowed to bypass the usual same-origin policies and don’t use CORS headers.
Warning
This is an important security measure; don’t disable it without understanding the security implications. In particular, if your authentication is cookie-based, you must either restrict the origins allowed by
check_origin()or implement your own XSRF-like protection for websocket connections. See these articles for more.To accept all cross-origin traffic (which was the default prior to Tornado 4.0), simply override this method to always return
True:def check_origin(self, origin): return True
To allow connections from any subdomain of your site, you might do something like:
def check_origin(self, origin): parsed_origin = urllib.parse.urlparse(origin) return parsed_origin.netloc.endswith(".mydomain.com")
Added in version 4.0.
- on_message(message)
Handle incoming messages on the WebSocket
This method must be overridden.
Changed in version 4.5:
on_messagecan be a coroutine.
- open()
Invoked when a new WebSocket is opened.
The arguments to open are extracted from the tornado.web.URLSpec regular expression, just like the arguments to tornado.web.RequestHandler.get.
open may be a coroutine. on_message will not be called until open has returned.
Changed in version 5.1:
openmay be a coroutine.
- petserver.getPetCoverage(args, queue, request_type)
- petserver.get_pet_coverage_splat(args, queue, request_type)
gets the PET coeverage using Splat! propagation loss computation
- petserver.main()
main function
- petserver.update_pet_data(sensor, flight_height, erp, lat_min, lat_max, lon_min, lon_max, X, Y, Z, dem_ws_client)
Updates PET data