Re: Grizzly WebSocket SSL

  • From: Oleksiy Stashok <oleksiy.stashok@...>
  • To: users@...
  • Subject: Re: Grizzly WebSocket SSL
  • Date: Fri, 20 Dec 2013 12:10:20 -0800

Hi Victor,

I think you missed
mGrizzlySSLServer.getListener("grizzly").setSecure(true);

Anyway, I added a WebSocket Server over SSL sample here [1]. The server initialization code is here [2].

WBR,
Alexey.

[1] https://java.net/projects/grizzly/sources/git/content/samples/websockets/chat-ssl
[2] https://java.net/projects/grizzly/sources/git/content/samples/websockets/chat-ssl/src/main/java/org/glassfish/grizzly/samples/websockets/ChatWebSocketSecuredServer.java

On 19.12.13 22:31, Victor Antonio Barzana wrote:
Thanks Oleksiy for your quickly response, here is my code of how I am creating my server:

// Create encrypted (SSL) server socket for wss:// protocol
if (mGrizzlySSLPort > 0) {
if (mLog.isDebugEnabled()) {
mLog.debug("Trying to initiate SSL on port " + mGrizzlySSLPort + "...");
}
if (mKeyStore != null && !mKeyStore.isEmpty()
&& mKeyStorePassword != null && !mKeyStorePassword.isEmpty()) {
if (mLog.isDebugEnabled()) {
mLog.debug("Using keystore " + mKeyStore + "...");
mLog.debug("Starting Grizzly SSL engine '"
+ getId()
+ "' at port " + mGrizzlySSLPort + ","
+ " with default timeout "
+ (mSessionTimeout > 0 ? mSessionTimeout + "ms" : "infinite")
+ "...");
}
try {
mGrizzlySSLServer = HttpServer.createSimpleServer(lDocumentRoot, mGrizzlySSLPort);
SSLContextConfigurator sslContext = new SSLContextConfigurator();
sslContext.setKeyStoreFile(lKeyStorePath);
sslContext.setKeyStorePass(mKeyStorePassword);
SSLEngineConfigurator lEngineConfigurator = new SSLEngineConfigurator(sslContext, false, false, false);
mGrizzlySSLServer.getListener("grizzly").setSSLEngineConfig(lEngineConfigurator);
mGrizzlySSLServer.getListener("grizzly").registerAddOn(new WebSocketAddOn());

// The WebSocketApplication will control the incoming and
//outgoing flow, connection, listeners, etc...
final WebSocketApplication lGrizzlyApplication = new GrizzlyWebSocketApplication(this);
// Registering grizzly jWebSocket Wrapper Application into grizzly WebSocketEngine
WebSocketEngine.getEngine().register("/jWebSocket", "/jWebSocket", lGrizzlyApplication);
mGrizzlySSLServer.start();
} catch (IOException lEx) {
mLog.error(Logging.getSimpleExceptionMessage(lEx, "instantiating SSL engine"));
}
} else {
mLog.error("SSL engine could not be instantiated due to missing configuration,"
+ " please set sslport, keystore and password options.");
}
}

When I try to connect from any browser client the response doesn't even arrive to my grizzly listeners inside the websocket application, what could be happening?

Thanks a lot, by the way, grizzly is a super good product, I am member of the jWebSocket team and we have one of our WebSocket engines based in Grizzly, very fast and reliable, as well scalable. My best regards to you guys.

Thanks,
Victor



Grizzly WebSocket SSL

Victor Antonio Barzana 12/19/2013

Re: Grizzly WebSocket SSL

Oleksiy Stashok 12/19/2013

Re: Grizzly WebSocket SSL

Victor Antonio Barzana 12/20/2013

Re: Grizzly WebSocket SSL

Oleksiy Stashok 12/20/2013
Terms of Use; Privacy Policy; Copyright ©2013-2016 (revision 20151030.c1dd42a)
 
 
Close
loading
Please Confirm
Close