Discussion:
[Freeciv-Dev] [bug #23283] Use libwebsockets in Freeciv-web, remove freeciv-proxy
Andreas Røsdal
2015-02-15 22:22:05 UTC
Permalink
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/
Marko Lindqvist
2015-02-19 21:34:12 UTC
Permalink
Follow-up Comment #1, bug #23283 (project freeciv):

At the moment I'm busy at fixing the json protocol problems, but I'll keep
this in mind as potential future project.

_______________________________________________________

Reply to this item at:

<http://gna.org/bugs/?23283>

_______________________________________________
Message sent via/by Gna!
http://gna.org/
Andreas Røsdal
2015-03-28 00:04:43 UTC
Permalink
Follow-up Comment #2, bug #23283 (project freeciv):

I would like to suggest that the Json protocol use WebSockets as the transfer
protocol, before the Json protocol is defined as done, given the great work
that has gone into the Json protocol recently. This would be a huge
improvement for Freeciv-web, and would also benefit the Freeciv desktop
clients. Here we could have a discussion about how to achieve this.

_______________________________________________________

Reply to this item at:

<http://gna.org/bugs/?23283>

_______________________________________________
Message sent via/by Gna!
http://gna.org/
Andreas Røsdal
2015-05-03 11:13:52 UTC
Permalink
Follow-up Comment #3, bug #23283 (project freeciv):

This is next on my wishlist of things to improve in Freeciv.

_______________________________________________________

Reply to this item at:

<http://gna.org/bugs/?23283>

_______________________________________________
Message sent via/by Gna!
http://gna.org/
Marko Lindqvist
2016-06-23 03:36:27 UTC
Permalink
Update of bug #23283 (project freeciv):

Depends on: => patch #7307


_______________________________________________________

Reply to this item at:

<http://gna.org/bugs/?23283>

_______________________________________________
Message sent via/by Gna!
http://gna.org/
Marko Lindqvist
2017-05-04 13:27:42 UTC
Permalink
Follow-up Comment #4, bug #23283 (project freeciv):

If you still want this, open a new request at hostedredmine:
https://www.hostedredmine.com/projects/freeciv/issues/new

_______________________________________________________

Reply to this item at:

<http://gna.org/bugs/?23283>

_______________________________________________
Message sent via/by Gna!
http://gna.org/

Loading...