Re: [Cppcms-users] websockets
Brought to you by:
artyom-beilis
From: Artyom B. <art...@gm...> - 2016-03-24 16:55:08
|
On Thu, Mar 24, 2016 at 3:53 PM, Shiv Shankar Dayal <shi...@gm...> wrote: > Hi, > > As far as I know CppCMS has planned wesockets for one of the future > releases. One of the best available libraries is > https://libwebsockets.org/index.html. Yes indeed it is planned for 1.4 with other HTTP server improvements http://cppcms.com/wikipp/en/page/cppcms_1x_tasks#HTTP.Server.improvements > Can we not simply integrate it > and provide a nice OO wrapper in CppCMS? > Probably you can on and **independent port** using CppCMS event loop but you would have problems with rest of the stuff that CppCMS provides for connections - you'll need to handle stuff like sessions manually Also I assume it would be simpler to implement WS support directly (finally it isn't that complicated protocol) HOWEVER I'd strongly discourage you from using WebSockets UNLESS you need real time BI-directional communication like a game where you need to send mouse movements or rapid key strokes to server in real time. (A) It isn't HTTP and vast majority of proxies do not forward it properly, so to make it work in real world you must use HTTPS. For example non-https web sockets do not work on mobile platforms that use proxy frequently. (B) it does not have proper Web Server interface i.e. you can't use it over FastCGI or SCGI you must run behind reverse HTTP proxy that handles web sockets as well. Frequently WebSockets used for Push only technology - for such a case I recommend to use Server Sent Events (a) it is true HTTP (b) it provides self synchronization features (c) it is much simpler to use and implement (d) it provides trivial to implement fallback (for both client and server) to long-polling in case older browser. > -- > Respect, > Shiv Shankar Dayal > Regards, Artyom Beilis |