Answer the question
In order to leave comments, you need to log in
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
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.
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
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
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 questionAsk a Question
731 491 924 answers to any question