Hi all, I have a CLI client and server written in Go Currently, they are
communicating via a socket connection and it's a server streaming connection
Now I want to have an Nginx proxy between these two

Is it possible to configure the normal socket connection in Nginx? How do
that, and what all code changes & configuration changes I need to do

There's not much on the internet on this on socket connection in Nginx I was
wondering if it's possible or not

//my client code:
func getStreammessages() {
        connection, err := net.Dial("tcp", "2.221.29.137:9988")
        _, err = connection.Write([]byte(sendIDtoServertoGetStream))
        for {
                mLen, err := connection.Read(buffer)
                //some logic to print the message stream
        }
}

//my server code:
func StartStreamServer() {
        server, err := net.Listen("tcp", "2.221.29.137:9988")
        defer server.Close()
        for {
                connection, err := server.Accept()
                go registerClient(connection)
        }
}
func registerClient(connection net.Conn) {
        buffer := make([]byte, 1024)
        mLen, err := connection.Read(buffer)
        var sendIDtoServertoGetStream message
        err = json.Unmarshal(buffer[:mLen], &sendIDtoServertoGetStream)
}

//strem to client from message queue
func StreamMessageToCliCLient(connection net.Conn) {
        _, err = connection.Write(messageString)
}
Have anyone done this before

currently, I am doing this in my Nginx (nginx.conf file) which is running in
the same VM as my server

stream {      
    server {
        auth_basic  off;
        proxy_ssl off;
        listen     80;
        #TCP traffic will be forwarded to the proxy_pass  #proxy_pass
3.111.69.167:9988;
        proxy_pass 127.0.0.1:8899;        
    }
}

I want to open Port 80 and Internally proxy pass to my server,
currently getting 400 status code, when I do this, and its not passing my
request to my server
 Can you pls help Thank you

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?2,294594,294594#msg-294594

_______________________________________________
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-le...@nginx.org

Reply via email to