Andreas Røsdal
2015-02-15 22:22:05 UTC
URL:
<http://gna.org/bugs/?23283>
Summary: Use libwebsockets in Freeciv-web, remove
freeciv-proxy
Project: Freeciv
Submitted by: andreasr
Submitted on: Sun 15 Feb 2015 10:22:04 PM UTC
Category: freeciv-web
Severity: 1 - Wish
Priority: 5 - Normal
Status: None
Assigned to: None
Originator Email:
Open/Closed: Open
Release:
Discussion Lock: Any
Operating System: GNU/Linux
Planned Release:
_______________________________________________________
Details:
I have long seen the need to use the libwebsockets[1] library in the
Freeciv-web C server, and remove the need for freeciv-proxy [2].
Currently the flow of a packet goes like this:
[Client browser] -> (JSON over websockets) -> [Nginx HTTP proxy server] ->
(JSON over websockets proxyed to correct Freeciv-proxy instance by nginx) ->
[Freeciv-proxy (Python WebSocket server running Tornado)] -> (JSON over
Freeciv binary socket packet format) -> [Freeciv-web C server]
I propose we simplyfy it to this instead:
[Client browser] -> (JSON over websockets) -> [Nginx HTTP proxy server] ->
(JSON over websockets proxyed to correct Freeciv-web server instance by
nginx) -> [Freeciv-web C server running libwebsockets]
This would involve implementing a WebSocket server inside the Freeciv server,
by using the libwebsockets library to send WebSocket messages using the
existing JSON packet code. It is important to enable websocket compression,
and to when sending multiple packets from the server to client to collect them
all and send as a single packet.
This will improve performance quite a lot, since Python is much slower than
the performance we can get with libwebsockets in C. Freeciv-proxy running on
Python is also limited by the Python GIL.
Marko, given all the great changes to the JSON network protocol recently, what
do you think of this proposal? I have tried and failed doing this once
previously, since I couldn't get it working, but I think you might be able
to.
[1] https://libwebsockets.org/ and https://github.com/warmcat/libwebsockets
[2] https://github.com/freeciv/freeciv-web/tree/master/freeciv-proxy
[3] http://www.tornadoweb.org/en/stable/
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?23283>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
<http://gna.org/bugs/?23283>
Summary: Use libwebsockets in Freeciv-web, remove
freeciv-proxy
Project: Freeciv
Submitted by: andreasr
Submitted on: Sun 15 Feb 2015 10:22:04 PM UTC
Category: freeciv-web
Severity: 1 - Wish
Priority: 5 - Normal
Status: None
Assigned to: None
Originator Email:
Open/Closed: Open
Release:
Discussion Lock: Any
Operating System: GNU/Linux
Planned Release:
_______________________________________________________
Details:
I have long seen the need to use the libwebsockets[1] library in the
Freeciv-web C server, and remove the need for freeciv-proxy [2].
Currently the flow of a packet goes like this:
[Client browser] -> (JSON over websockets) -> [Nginx HTTP proxy server] ->
(JSON over websockets proxyed to correct Freeciv-proxy instance by nginx) ->
[Freeciv-proxy (Python WebSocket server running Tornado)] -> (JSON over
Freeciv binary socket packet format) -> [Freeciv-web C server]
I propose we simplyfy it to this instead:
[Client browser] -> (JSON over websockets) -> [Nginx HTTP proxy server] ->
(JSON over websockets proxyed to correct Freeciv-web server instance by
nginx) -> [Freeciv-web C server running libwebsockets]
This would involve implementing a WebSocket server inside the Freeciv server,
by using the libwebsockets library to send WebSocket messages using the
existing JSON packet code. It is important to enable websocket compression,
and to when sending multiple packets from the server to client to collect them
all and send as a single packet.
This will improve performance quite a lot, since Python is much slower than
the performance we can get with libwebsockets in C. Freeciv-proxy running on
Python is also limited by the Python GIL.
Marko, given all the great changes to the JSON network protocol recently, what
do you think of this proposal? I have tried and failed doing this once
previously, since I couldn't get it working, but I think you might be able
to.
[1] https://libwebsockets.org/ and https://github.com/warmcat/libwebsockets
[2] https://github.com/freeciv/freeciv-web/tree/master/freeciv-proxy
[3] http://www.tornadoweb.org/en/stable/
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?23283>
_______________________________________________
Message sent via/by Gna!
http://gna.org/