A
A
Alexander2011-01-12 01:42:16
Web servers
Alexander, 2011-01-12 01:42:16

What should the websockets module do?

I decided to implement a module for websockets,
there were questions about the implementation of the logic
, as I understand it, the WEB server must accept the headers for the connection,
give the appropriate headers to the client and forward the connection to the backend.
then a permanent connection hangs and the WEB server works as a proxy.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
vsviridov, 2011-01-13
@vsviridov

See how they are made for nodejs, read the specs. But don't forget that the latest version of the protocol contains a vulnerability and has been withdrawn from Firefox & Opera.

M
Mikhail Davydov, 2011-01-13
@azproduction

You have 2 ways. From scratch www.whatwg.org/specs/web-socket-protocol/
Or see how it is done in the socket.io server part/ Here is the ws logic file github.com/LearnBoost/Socket.IO-node/blob/master/lib /socket.io/transports/websocket.js

A
Alexander, 2011-01-13
@akalend

how to do it from scratch - it’s more or less clear
I wanted to integrate into an existing WEB server
, that’s why the question

M
Mikhail Davydov, 2011-01-13
@azproduction

Right now nginx can't proxy Websockets, I'm not sure about Apache. And I did not find any modules for native ws support.
You can do this: raise the WebSocket backend (node.js + socket.io) put HAProxy in front of nginx, which will forward requests to the ws backend directly.
Well, here's another option on php + phpDaemon instead of node.js + socket.io stack: habrahabr.ru/blogs/webdev/82140/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question