WSS with Draft10 Support
Tamirk
tamirklein at hotmail.com
Mon Oct 31 05:36:54 EDT 2011
Hi,
Sure here goes:
1) I installed local certificate on my Apache server using openssl
(http://slacksite.com/apache/certificate.php)
2) I modified WebSocketServerHandler.getWebSocketLocation to the following:
private String getWebSocketLocation(HttpRequest req) {
return "wss://" + req.getHeader(HttpHeaders.Names.HOST) + WEBSOCKET_PATH;
}
3) I copy paste the code in WebSocketServerIndexPage to testNettyWS.html and
put it under my web root directory
4) I modified the socket init code to the following:
socket = new WebSocket("wss://localhost:8080/");
5) I run the WebSockerServer and bind port 8080
6) I now browse to https://localhost/testNettyWS.html and I get the below
error
Oct 31, 2011 11:28:43 AM
org.jboss.netty.example.http.websocketx.server.WebSocketServerHandler
FINE: Channel 792386646 is open
java.lang.IllegalArgumentException: empty text
at
org.jboss.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.java:95)
at
org.jboss.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.java:68)
at
org.jboss.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.java:81)
at
org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:198)
at
org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:107)
at
org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:470)
at
org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:443)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:275)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:262)
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:340)
at
org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:271)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:191)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
java.lang.IllegalArgumentException: invalid version format: ?_?_?__
Note: I also tried to connect to the SecureChatServerExample found in the
example folder but I got similar error.
Please let me know if this is clear enough to troubleshoot.
If my approach is wrong and I need to set this up in a different way please
let me know.
Cheers,
Tamir
http://netty-forums-and-mailing-lists.685743.n2.nabble.com/file/n6947532/testNettyWS.html
testNettyWS.html
http://netty-forums-and-mailing-lists.685743.n2.nabble.com/file/n6947532/WebSocketServerHandler.java
WebSocketServerHandler.java
Hi,
No problems. Please outline:
1. What you are trying to do?
If you are running the server sample in
org.jboss.netty.example.http.websocketx.server.WebSocketServer, you should
be able to point your browser to http://localhost:8080.
2. What errors are you getting? Can you post a bit more code so we can get
some context.
Regards
Vibul
On 31 October 2011 18:35, Tamirk <tamirklein@> wrote:
> Hi Vibul,
>
> Yes I'm using this example and it's working great!!!
>
> // Handshake
> WebSocketServerHandshakerFactory wsFactory = new
> WebSocketServerHandshakerFactory(
> this.getWebSocketLocation(req), null, false);
> this.handshaker = wsFactory.newHandshaker(ctx, req);
> if (this.handshaker == null) {
> wsFactory.sendUnsupportedWebSocketVersionResponse(ctx);
> } else {
> this.handshaker.executeOpeningHandshake(ctx, req);
> }
> return;
>
>
> My problem is when I try to connect to wss://localhost:8080/websocket I
> failed to get a connection.
>
> I tried several approaches but nothing is working out of the box :(
>
> Can you direct me how to resolve this.
>
> Cheers,
>
> Tamir
>
> --
> View this message in context:
> http://netty-forums-and-mailing-lists.685743.n2.nabble.com/WSS-with-Draft10-Support-tp6945374p6947226.html
> Sent from the Netty User Group mailing list archive at Nabble.com.
> _______________________________________________
> netty-users mailing list
> netty-users at .jboss
> https://lists.jboss.org/mailman/listinfo/netty-users
>
_______________________________________________
netty-users mailing list
netty-users at .jboss
https://lists.jboss.org/mailman/listinfo/netty-users
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/WSS-with-Draft10-Support-tp6945374p6947532.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list