Because you talk to SERVER via tcp, I guess that you actually want to use a long-alive tcp connection to communicate with server, but for WEBAPP ---> MW-NETTY communicating, you would rather to apply a one-connection-per-request strategy, because it is http protocol.
First of all, I guess that you want to implement the middleware via my advice in a previous topic in this discuss group. In this way, you should guarantee that in the SERVER's response, there is the id somewhere(in HEAD or BODY), so you can get the right WEBAPP connection for each WERVER's response. Another thing you may what to do is you should parse the http request to get the id. Netty has afford some http utilities, you can consider the HttpServerCodec: https://github.com/netty/netty/blob/4.1/codec-http/src/main/java/io/netty/handler/codec/http/HttpServerCodec.java Netty has also afford examples to show how to use it: https://github.com/netty/netty/blob/4.1/example/src/main/java/io/netty/example/http/helloworld/HttpHelloWorldServerInitializer.java Good Luck! On Thursday, March 16, 2017 at 5:08:09 PM UTC+8, Nicolas Ocquidant wrote: > > I implemented a middleware in Netty based on the HexDumpProxy example: > > BROWSER ------> WEBAPP ------> MW-NETTY ------> SERVER > [http] [http] [tcp] > > > The MW-NETTY (see above) needs to connect to the SERVER using a port > number different for each customer (the WEBAPP is dedicated by customer). > So, as a last resort, the TCP port could be disabled to preserve the > SERVER... > > The client id is transported in an HTTP header from WEBAPP to MW-NETTY. > As the channels are created before messages arrive, what would be the best > strategy? > > Thanks, > --nick > -- You received this message because you are subscribed to the Google Groups "Netty discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/netty/c69b219b-f7fe-4374-8471-fcbb2f7e03d9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
