[undertow-dev] Can't get customed header and attributes in the websocket handshakeheader.

Stuart Douglas sdouglas at redhat.com
Mon Apr 14 21:56:13 EDT 2014


This has been improved greatly in Undertow 1.0.5.Final.

You can now provide an instance of 
io.undertow.websockets.client.WebSocketClientNegotiation that allows you 
to modify the headers.

Stuart


张林 wrote:
> Hi,
> We registed a web socket handler in the server, waiting for the clients
> to connect. According to the usiness, we need to identify (or mark) a
> client when it do handshake with the server, so I tried to set some
> customed headers in the handshakeheader, just like:
> WebSocketConnectionManager manager = new WebSocketConnectionManager(
>                  webSocketClient, webSocketHandler,
> "ws://localhost:8080/websocket/myHandler");
> manager.setAutoStartup(true);
> *manager.getHeaders().add("myHeader", "1234567");*
> return manager;
>
> I supposed to retrieve it from the WebSocketSession in the serverside,
> but I can't get it. it is ok in the jetty server 9.
>
>
> The server we used: wildfly 8.0.3 Release
> The client dependencies:
> <dependency>
> <groupId>org.springframework</groupId>
> <artifactId>spring-context</artifactId>
> <version>4.0.3.RELEASE</version>
> </dependency>
> <dependency>
> <groupId>org.springframework</groupId>
> <artifactId>spring-websocket</artifactId>
> <version>4.0.3.RELEASE</version>
> </dependency>
> <dependency>
> <groupId>javax.websocket</groupId>
> <artifactId>javax.websocket-api</artifactId>
> <version>1.0</version>
> <scope>compile</scope>
> <optional>true</optional>
> </dependency>
> <dependency>
> <groupId>io.undertow</groupId>
> <artifactId>undertow-websockets-jsr</artifactId>
> <version>1.0.3.Final</version>
> </dependency>
>
> This issue blocked me for some days, could you please help to figure out
> what's the matter, and it is really appreciate if you can give some
> advice to achieve that. Thank you very much!
>
>
> Sincerely yours,
> Lynn
>
> _______________________________________________
> undertow-dev mailing list
> undertow-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev


More information about the undertow-dev mailing list