Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebSocket and CGI/FastCGI/SCGI protocols

I'm looking for resources about interaction between client side web socket, web server and real application backend that works behind CGI, FastCGI or SCGI protocols.

It seems that this is impossible at this point as:

Request length is specifically defined in CONTENT_LENGTH variable so I can't expect that the data would continue to come from web server from stdin, or may I? as unset CONTENT_LEGTH defines no-request body.

Application require to read CONTENT_LEGTH bytes of date no-more and if less are read then it is considered as disconnected client.

  • Are there any resources on how (F|C)CGI is updated or can be used with WebSockets?
  • Are there any drafts of SCGI/FCGI/CGI specks for WebSockets support?
  • Are there any known web servers that support WebSockets?
  • If so, do they support *CGI protocols for them?
  • Have you had any experience with working with WebSockets and *CGI?

Thank you, all information would be appropriate.

Artyom

Anybody?

like image 791
Artyom Avatar asked Jul 11 '10 10:07

Artyom


People also ask

Which protocol is used by WebSockets?

The WebSocket protocol is an independent TCP-based protocol. Its only relationship to HTTP is that its handshake is interpreted by HTTP servers as an Upgrade request. By default the WebSocket protocol uses port 80 for regular WebSocket connections and port 443 for WebSocket connections tunneled over TLS [RFC2818].

Is WebSocket a Layer 7 protocol?

WebSocket is distinct from HTTP. Both protocols are located at layer 7 in the OSI model and depend on TCP at layer 4.

Is WebSocket application layer protocol?

HTTP, SSL, HTTPS, WebSockets, etc. are all application layer protocols.

Is WebSocket HTTP protocol?

WebSocket is an event-driven protocol, which means you can actually use it for truly realtime communication. Unlike HTTP, where you have to constantly request updates, with websockets, updates are sent immediately when they are available.


1 Answers

You can find a mod_websocket module for lighttpd here. When building the module, be sure to specify the correct websocket protocol version you want to use (version -75 or -76). Starting with WebKit nightly build r59903 and Chrome 6.0.414.0 (r47952) only protocol version -76 is supported.

Note that with using WebSockets, you no longer need CGI, FastCGI or SCGI protocols for connecting the web server with the application back end. Just implement a TCP listener in your application (for mod_websocket to connect to) and use the socket for asynchronous I/O.

like image 197
raffel Avatar answered Oct 05 '22 10:10

raffel