Apache / Websockets: Direct Sockets to Different (Or To Both) Ports Based On Path – ProxyPass

I am running a website on Apache. I have two apps that use web sockets, one is based on Node, which uses port 3000 and the other is based on Phoenix, which uses port 4000. Both apps also use a reverse proxy. For example, I have something like this:

  <Location /node/>
    ProxyPass http://127.0.0.1:3000/
    ProxyPassReverse http://127.0.0.1:3000/
  </Location>

  <Location /phoenix/>
    ProxyPass http://127.0.0.1:4000/
    ProxyPassReverse http://127.0.0.1:4000/
  </Location>

However, I am having problems getting the web sockets to work. I have something like this this set up for the Node app (outside the <Location> context):

  RewriteCond %{QUERY_STRING} transport=polling       (NC)
  RewriteRule /(.*)           http://127.0.0.1:3000/$1 (P)
  RewriteCond %{HTTP:Upgrade} websocket               (NC)
  RewriteRule /(.*)           ws://127.0.0.1:3000/$1  (P)

I developed my Node app a few years ago and everything worked perfectly. However, I am currently developing the Phoenix app, and I don’t know how to handle directing the sockets. Eventually, I plan on phasing out the Node app completely, but I need to keep it running for our users until the new app is developed. However, I still need the new app running at the same time on the website so I can develop it. It would be nice to get sockets working on both apps at the same time.

sockets – How does Trello notify clients when updates are available?

sockets – How does Trello notify clients when updates are available? – Software Engineering Stack Exchange

Is there a conventional URI scheme for local sockets (AF_UNIX)?

I’m looking at creating a class which accepts a string to define a Unix socket address.

Linux supports three types of addresses for Unix sockets:

  1. File based addresses (also called named domain addresses)
  2. Abstract addresses
  3. Unnamed addresses

The first is the conventional method which works on pretty much all Unices.

The second is only available on Linux. It accepts a name of up to 107 characters which is composed of any binary byte. The convention, though, has been to use a Java-like name such as /com/ubuntu/background/file as seen in dbus.

The third is used between parent & child (created by fork() or fork() + exec().) The parent creates two sockets, one for the parent and one for the child and then uses one to read/write and the child uses the other.

We have well defined schemes for things such as http://, ftp://, etc. Are there any such official definitions for AF_UNIX based sockets?

I could foresee something such as:

  • local:///<full-path-to-file>
  • dbus:///<abstract-path>
  • unnamed:

Note:

A unix: protocol would work too, but then I could not distinguish between each type supported by Linux.

PHP sockets em JAVA – Stack Overflow em Português

Tenho o seguinte código, funcional, numa aplicação em PHP:

    $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
    socket_connect($sock, '127.0.0.1', 350);

    $msg = "MODIFY,buffer,01,";
    $len = strlen($msg);
    socket_send($sock, $msg, $len,MSG_DONTROUTE); 
    $text = socket_read($sock, 100);  
    socket_close($sock);

e neste momento necessito dele mas para uma aplicação em JAVA, alguém me consegue “traduzir”?

Getting html page using get http request and sockets in C

Im trying to print the html page https://pastebin.com/raw/7y7MWssc

Here is my code :

#include <stdio.h>
#include <winsock2.h>

void main(){
    WSADATA WSA;
    WSAStartup(MAKEWORD(2,2),&WSA) ;

    char  Request() = "GET /raw/7y7MWssc HTTP/1.1rnrn" ;
    char  Response(2000) ;

    SOCKET  Socket = socket(AF_INET , SOCK_STREAM , 0 );
    struct sockaddr_in Server;
    struct hostent *H = gethostbyname("pastebin.com") ;

    Server.sin_addr.s_addr  = *( (int *)H->h_addr);
    Server.sin_family       = AF_INET;
    Server.sin_port         = htons( 80 );

    connect(Socket , (struct sockaddr *)&Server , sizeof(Server)) ;
    send(Socket , Request , strlen(Request) , 0)  ;
    int Rs = recv(Socket , Response , 2000 , 0) ;
    Response(Rs) = 0 ;
    printf("%sn", Response );

    closesocket(Socket);
    WSACleanup();
}

But i keep getting 400 Bad Request as response , but when the request is “GET /raw/7y7MWssc HTTP/1.1rnHost: pastebin.comrnrn” i get 301 Moved Permanently to the Location: https://pastebin.com/raw/7y7MWssc
Thanks for help

networking – When to use HTTP Long polling over Web sockets?

I understand difference between Websocket and HTTP long polling and I understand if there is a real time need of bi-direction communication, then we should use web socket. I want to understand some use case where HTTP Long push can outperform websockets?

Anywhere where we can use HTTP Long poll,we can use websockets to do same, what are some pros of HTTP Long poll over websockets? How does apps like twitter,fb,etc. handles connection of users to handle real time updates? I read about facebook and they uses long polling instead of websockets. What are pros of long polling over Websockets?

computer networks – Why should you use IP addresses instead of hostnames when using Sockets?

Thanks for contributing an answer to Computer Science Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

nodejs – como enviar eventos a distintos sockets en particulares

estoy buscando enviar eventos a distintos sockets, tengo el backend echo con nodejs y typescript y el frontend con react, todo funciona bien, cuando el cliente se conecta al socket, automáticamente se hace un update mediante mongoose que actualiza el socketid de mi modelo de datos, esto lo hago para tener el id del socket de cada usuario en la base de datos, mi idea es que cuando un usuario haga una acción, se envíen ciertos datos a ciertos usuarios,

const EmitterNewLike = async (_id: String, usr: IUsuario) => {
  const socket = getSocket();
  const publicacion: IPublicaciones | null = await Publicaciones.findById(
    _id
  ).populate({ path: "usuario" });
  socket.to((id, id, id, id ))emit("NEW_LIKE", publicacion, usr);
};

estoy buscando hacer algo como lo que se ve aquí, enviar mediante un .to(), un array de los id que van a recibir ese evento, obviamente esto no funciona, pero estoy buscando hacer algo similar para enviar eventos a ciertos usuario

sockets – Set python 3 server to take action after receiving tcp packet on that port

I have set up a server using Python3. Which will be listening on a specific port. From the client-side, I want to send a TCP request using hping3. I want to set the server in such a way so that it should perform some actions after receiving that TCP request. Looking for ideas to do that.

Thanks In advance.

DreamProxies - Cheapest USA Elite Private Proxies 100 Cheapest USA Private Proxies Buy 200 Cheap USA Private Proxies 400 Best Private Proxies Cheap 1000 USA Private Proxies 2000 USA Private Proxies 5000 Cheap USA Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive.com Proxies-free.com New Proxy Lists Every Day Proxies123.com Proxyti.com Buy Quality Private Proxies